3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $myObj = (object)array('id' => 'foo', 'cat_1' => 'bar', 'cat_2' => 'baz'); print_r($myObj); $count = 0; foreach ($myObj as $key => $value) { if (strpos($key, 'cat_') === 0) { $count++; } } var_dump($count);
Output for 4.3.0 - 7.1.0
stdClass Object ( [id] => foo [cat_1] => bar [cat_2] => baz ) int(2)