3v4l.org

run code in 300+ PHP versions simultaneously
<?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.4.0 - 7.4.1
391720 3000 399944
Output for 7.3.0 - 7.3.13
391872 3000 400096
Output for 7.2.0 - 7.2.26
388000 3000 396224
Output for 7.1.0 - 7.1.33
351424 3000 359648
Output for 7.0.0 - 7.0.33
351400 3000 359624
Output for 5.6.23 - 5.6.40
232488 3000 298328
Output for 5.6.0 - 5.6.22
232488 0 1066432
Output for 5.5.37 - 5.5.38
232456 3000 298272
Output for 5.5.0 - 5.5.36
232456 0 1066360
Output for 5.4.0 - 5.4.45
232760 0 1066680
Output for 5.3.15 - 5.3.29
637784 0 1807608
Output for 5.3.11 - 5.3.14
637784 0 1807584
Output for 5.3.9 - 5.3.10
637480 0 1807280
Output for 5.3.1 - 5.3.8
637480 0 1799256
Output for 5.3.0
637480 0 1791248
Output for 5.1.0 - 5.1.6, 5.2.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.3.11, 4.4.0 - 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.

preferences:
215.89 ms | 401 KiB | 325 Q