3v4l.org

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