I have a string that, when divided up by its only delimited ("="), comes out to be in the following form:
time0 -> 2016-03-18T01:33:52Z
time1 -> 2016-03-18T00:25:54Z
timezone0 -> GMT
timezone1 -> GMT
type0 -> Subscription
type1 -> General
email1 -> email@email.com
name0 -> first
name1 -> second
tr0 -> ###
tr1 -> ###
st0 -> Created
st1 -> Completed
amt1 -> 19.95
currency1 -> USD
fee1 -> -0.88
net1 -> 19.07
Here is the code for it ($result holds the full string):
foreach($result as $value){
$value = explode("=", $value);
print $value[0] . " -> " .$value[1] . "<br/>";
}
As you can see, there are 2 types of categories, one which is "Subscription" and one which is "General". What I am essentially looking to do is filter out for only a specific type. For example, if I am looking for type "Subscription", then the output should be as follows:
time0 -> 2016-03-18T01:33:52Z
timezone0 -> GMT
type0 -> Subscription
name0 -> first
tr0 -> ###
st0 -> Created
If there were multiple types with "subscription" (e.g. type0
and type2
were "Subscription"), then it would return the time0
and type2
, timezone0
and timezone2
, tr0
and tr2
etc.
Is this possible?