3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php class Foo extends ArrayObject { public $x; public function __construct($self) { $this->x = $self; } } Class Bar { static function create(){ $b = new Bar(); $b->f = new Foo($b->get()); } function get(){ return $this; $self = $this; return function() use ($self) {return $self;}; } } echo memory_get_usage(), "\n"; for ($i = 0; $i < 1000; ++$i) { Bar::create(); } echo gc_collect_cycles() . "\n"; echo memory_get_usage(), "\n";
Output for 7.1.0
351496 3000 359720
Output for 7.0.0 - 7.0.4, 7.0.6 - 7.0.14
351472 3000 359696
Output for 7.0.5
351504 3000 359728
Output for 5.6.28
232672 3000 298512
Output for 5.6.7 - 5.6.21
232672 0 1066600
Output for 5.5.24 - 5.5.35
232640 0 1066536
Output for 5.4.0 - 5.4.45
232944 0 1066896
Output for 5.3.15 - 5.3.29
638328 0 1808136
Output for 5.3.11 - 5.3.14
638328 0 1808144
Output for 5.3.9 - 5.3.10
638024 0 1807848
Output for 5.3.1 - 5.3.8
638024 0 1799784
Output for 5.3.0
638024 0 1791792
Output for 5.1.0 - 5.2.17
Parse error: syntax error, unexpected T_FUNCTION in /in/M7Mr3 on line 21
Process exited with code 255.
Output for 5.0.0 - 5.0.5
Parse error: parse error, unexpected T_FUNCTION in /in/M7Mr3 on line 21
Process exited with code 255.
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/M7Mr3 on line 5
Process exited with code 255.
Output for 4.3.1, 4.3.5 - 4.4.1
Parse error: parse error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/M7Mr3 on line 5
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error, expecting `T_OLD_FUNCTION' or `T_FUNCTION' or `T_VAR' or `'}'' in /in/M7Mr3 on line 5
Process exited with code 255.
Output for 4.3.0
Parse error: parse error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/p1rhB on line 5
Process exited with code 255.