3v4l.org

run code in 300+ PHP versions simultaneously
<?php // Source: https://bugs.php.net/bug.php?id=62468 class SelfLinked { public $xml; public $me; public function __construct() { $this->xml = simplexml_load_string('<?xml version="1.0" encoding="UTF-8"?> <a><b><c><d><e><f><g><h><i><j><k><l><m><n><o><p><q><r><s><t><u><v><w><x><y><z>waa? </z></y></x></w></v></u></t></s></r></q></p></o></n></m></l></k></j></i></h></g></f></e></d></c></b></a>'); $this->me = $this; } } $b = memory_get_usage(); for ($i = 0; $i < 1000; $i++) { new SelfLinked(); //gc_collect_cycles(); } var_dump(memory_get_usage() - $b);
Output for 7.0.0 - 7.0.20, 7.1.0 - 7.1.7, 7.2.0
int(296192)
Output for 5.6.0 - 5.6.28
int(449920)
Output for 5.5.0 - 5.5.36
int(449904)
Output for 5.4.0 - 5.4.45
int(449912)
Output for 5.3.11 - 5.3.29
int(929856)
Output for 5.3.0 - 5.3.10
int(929880)
Output for 5.2.10 - 5.2.17
int(889632)
Output for 5.2.7 - 5.2.9
int(889824)
Output for 5.2.3 - 5.2.6
int(889880)
Output for 5.2.2
int(889776)
Output for 5.2.1
int(890016)
Output for 5.0.0 - 5.0.5, 5.1.0 - 5.1.6, 5.2.0
Fatal error: Call to undefined function memory_get_usage() in /in/pXgXm on line 18
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/pXgXm on line 6
Process exited with code 255.
Output for 4.3.0 - 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/pXgXm on line 6
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/pXgXm on line 6
Process exited with code 255.

preferences:
132.52 ms | 401 KiB | 208 Q