3v4l.org

run code in 300+ PHP versions simultaneously
<?php public function testPushAndPop() { $stack = array(); $this->assertEquals(0, count($stack)); array_push($stack, 'foo'); $this->assertEquals('foo', $stack[count($stack)-1]); $this->assertEquals(1, count($stack)); $this->assertEquals('foo', array_pop($stack)); $this->assertEquals(0, count($stack)); } testPushAndPop; ?>
Output for 5.4.0 - 5.4.15
Parse error: syntax error, unexpected 'public' (T_PUBLIC) in /in/QZW4Q on line 2
Process exited with code 255.
Output for 5.3.0 - 5.3.25
Parse error: syntax error, unexpected T_PUBLIC in /in/QZW4Q on line 2
Process exited with code 255.

preferences:
190.38 ms | 1395 KiB | 49 Q