I’ve got the following array:
$myArray
: array =
0: array =
0: string = 2012
1: string = 1
2: string = JOHN
1: array =
0: string = 2012
1: string = 2
2: string = JOHN
2: array =
0: string = 2012
1: string = 3
2: string = MARK
I’ve also have the variable $name.
Let’s say that this time $name equals JOHN
What do I have to do to have a new array with just the elements that contain JOHN like this:
$myArray
: array =
0: array =
0: string = 2012
1: string = 1
2: string = JOHN
1: array =
0: string = 2012
1: string = 2
2: string = JOHN
Thanks a million!
This function returns an array containing only the values you want.