Jump to content

Find Term within an array


brooksh

Recommended Posts

I'm sure there's a more efficient way using an array_map, but this is the best I can come up with off the top of my head.

 

$array = array("11:23", "12:46", "13:34", "14:34", "14:85");
foreach($array as $value) {
    if(strpos($value, "12") !== FALSE) {
          echo "Yes";
    }
}

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.