3v4l.org

run code in 300+ PHP versions simultaneously
<?php class foo { private bar; function __construct () { $this->bar = 1; } function add() { $this->bar+=1; } } $one = $two = $three = new foo(); $one->add(); var_dump($one); var_dump($two);
Output for 5.4.0 - 5.4.14
Parse error: syntax error, unexpected 'bar' (T_STRING), expecting variable (T_VARIABLE) in /in/afSGG on line 3
Process exited with code 255.
Output for 5.3.0 - 5.3.24
Parse error: syntax error, unexpected T_STRING, expecting T_VARIABLE in /in/afSGG on line 3
Process exited with code 255.

preferences:
176.38 ms | 1395 KiB | 47 Q