3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php trait Math { public add($item1, $item2) { return $item1 + $item2; } } trait Cart { public add_cart($item1, $item2) { return $item1 + $item2; } } class x { use Math, Cart; public function __construct() { $x =& $this; $x = new stdClass; var_dump($this); } } $x = new x; echo $x -> add(4,9);
Output for 5.4.0 - 5.4.9
Parse error: syntax error, unexpected 'add' (T_STRING), expecting variable (T_VARIABLE) in /in/q4W4p on line 5
Process exited with code 255.
Output for 5.3.0 - 5.3.19
Parse error: syntax error, unexpected T_STRING in /in/q4W4p on line 3
Process exited with code 255.