3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class Hoge { private $hoge = null; private $fuga = null; public function __construct($hoge = []) { $this->set($hoge); } private function set($hoge = []) { foreach ($this as $key => $value) { $this->$key = (true === isset($hoge[$key])) ? $hoge[$key] : $value; var_dump($key, $value, $hoge[$key]); } } } $hoge = new Hoge(['hoge' => 1111, 'fuga' => 2222]);
based on Bt92c
Output for 5.6.0 - 5.6.30, hhvm-3.18.4 - 3.21.0, 7.0.0 - 7.3.0beta1
string(4) "hoge" NULL int(1111) string(4) "fuga" NULL int(2222)