3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class Foo { protected $foo; protected $bar; protected $baz; } $aHydrator = function(array $data) { $this->a = $data['a']; $this->b = $data['b']; $this->c = $data['c']; }; $data = array('foo' => 1, 'bar' => 2, 'baz' => 3); $hydrated = new Foo(); $data = array('a' => 1, 'b' => 2, 'c' => 3); $a = new A(); ($aHydrator->bindTo($a, $a))($data); var_dump($hydrated);
based on Tca93
Output for 7.0.0 - 7.2.0
Fatal error: Uncaught Error: Class 'A' not found in /in/RjmMa:22 Stack trace: #0 {main} thrown in /in/RjmMa on line 22
Process exited with code 255.
Output for 5.3.21 - 5.6.28
Parse error: syntax error, unexpected '(' in /in/RjmMa on line 23
Process exited with code 255.