Link to home
Start Free TrialLog in
Avatar of mnb93
mnb93

asked on

Return Array Elements that contain...

array (

[1] => 'uy87yh879sf s9d08fusdf 980dsf98 21/05/2006jidosfj89sd9 89uds9'

[2] => 'uy8/05/2006jidosfj89sd9 89uds9'

[3] => 'uy87yh879sf s9d08fusdf 980dsf98 21/089uds9'

[4] => 'uy87yh 21/05/2006jidosfj89sd9 89uds9'

[5] => '21/05/20069'

[6] => ' 21/05/2006jido'

 )

Returns 1,5,6

That is what I would like.

How would I go about accomplishing this?
ASKER CERTIFIED SOLUTION
Avatar of Roonaan
Roonaan
Flag of Netherlands image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of aminerd
aminerd

Or...

$match = preg_grep('/21\/05\/2006/', $array);
var_dump($match);

If you want the keys, you can add:

$keys = array_keys($match);



http://php.net/preg_grep