3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $row = array( 'useless' => 42, 'useful' => 'orange', 'useless_too' => 'banana', 'useful_too' => 'apples'); foreach ($row as $key1=>$value){ $pos = strpos($key1,'useful'); if($pos==-1) unset($row[$key1]); } print_r($row);
Output for 4.3.0 - 7.1.0
Array ( [useless] => 42 [useful] => orange [useless_too] => banana [useful_too] => apples )