3v4l.org

run code in 300+ PHP versions simultaneously
<?php trait Math { public add($item1, $item2) { return $item1 + $item2 } } trait Cart { public add_cart($item1, $item2) { return $item1 + $item2; } } class x { public function __construct() { $x =& $this; $x = new stdClass; var_dump($this); } } var_dump(new x);
Output for 5.4.0 - 5.4.9
Parse error: syntax error, unexpected 'add' (T_STRING), expecting variable (T_VARIABLE) in /in/hGJLu 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/hGJLu on line 3
Process exited with code 255.

preferences:
169.41 ms | 1395 KiB | 37 Q