3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $sessionArray = array( 'Romero' => 2, 'Ronaldinho' => 4, 'ronaldo' =>8, 'messi' => 20 ); $str="ro"; $id = array(); $name = array(); foreach($sessionArray as $key => $value) { if(strpos(strtolower($key), strtolower($str)) !== FALSE) { $id[] = $value; $name[] = $key; } } print_r($id); echo "\n"; print_r($name);
Output for 4.3.0 - 7.1.0
Array ( [0] => 2 [1] => 4 [2] => 8 ) Array ( [0] => Romero [1] => Ronaldinho [2] => ronaldo )