I have an array:
$myarray = "A1&1&B1&1&C1&1&D1&1&B1&1&"
You can see that this is an array within an array, The first set of information is separated by the ampersand while the array itself is separated by a karat.
Doing a explode of ^ I would get:
$myarray[0] = A1&1
$myarray[1] = B1&1
etc...
Doing an explode of & I would get
$pieces[0] = A1
$pieces[1]=1
and so forth.
What I am trying to do is find if the occurance of $pieces[0] is found elsewhere in the array. I do not care about $pieces[1], this can be the same in the array.
So in my example you see that B1 repeats itself twice:
$myarray = "A1&1&B1&1&C1&1&D1&1&B1&1&"
Is there a string function I can use or a way to right the code correctly to do this. I am pulling my hair out and it is probably a simple solution.
Thanks for any help!