3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class Foo { private $item; public function __construct ($item) { $this->item = $item; } public function gerade ($var) { return (($this->item % $var) === 0); } } $baz = []; $array2 = array(6, 7, 8, 9, 10, 11, 12); $bar = new Foo(3); foreach ($array2 as $var){ die(var_dump($bar->gerade($var))); if($bar->gerade($var)) $baz = array_merge($baz, $var); } print_r($baz);
based on 2bGO7
Output for 5.4.2 - 7.2.0
bool(false)
Output for 5.3.18 - 5.3.29
Parse error: syntax error, unexpected '[' in /in/DL66Z on line 12
Process exited with code 255.