3v4l.org

run code in 300+ PHP versions simultaneously
<?php class AbstractFoo { protected $data = array('dsdsdssdssdsd','sdvuiouthskrjeklajklsdajfklsdjfsdkfhjksdhfdjkfhksdhf','vhweuihfeaajklfldajfafhkashdjdahjkadfhsdjkfhdjkfhjksf', 'Äfhdsuihcdhckdufhdjkfhjkdhfjkdfhjkdfhjkdshfjfdsfsdfdsfdsfds'); protected $data2 = array('dsdsdssdssdsd','sdvuiouthskrjeklajklsdajfklsdjfsdkfhjksdhfdjkfhksdhf','vhweuihfeaajklfldajfafhkashdjdahjkadfhsdjkfhdjkfhjksf', 'Äfhdsuihcdhckdufhdjkfhjkdhfjkdfhjkdfhjkdshfjfdsfsdfdsfdsfds'); protected $data3 = array('dsdsdssdssdsd','sdvuiouthskrjeklajklsdajfklsdjfsdkfhjksdhfdjkfhksdhf','vhweuihfeaajklfldajfafhkashdjdahjkadfhsdjkfhdjkfhjksf', 'Äfhdsuihcdhckdufhdjkfhjkdhfjkdfhjkdfhjkdshfjfdsfsdfdsfdsfds'); protected static $state = array(); public function publish() { static::$state[] = $this; } } $foo = new AbstractFoo; var_dump(memory_get_usage()); $foo->publish(); var_dump(memory_get_usage()); $foo->publish(); var_dump(memory_get_usage()); $foo->publish(); var_dump(memory_get_usage()); $foo->publish(); var_dump(memory_get_usage()); $foo->publish(); var_dump(memory_get_usage());
Output for 7.4.0
int(392216) int(392624) int(392624) int(392624) int(392624) int(392624)
Output for 7.3.0 - 7.3.12
int(392192) int(392600) int(392600) int(392600) int(392600) int(392600)
Output for 7.2.0 - 7.2.25
int(388272) int(388624) int(388624) int(388624) int(388624) int(388624)
Output for 7.1.0 - 7.1.33
int(351568) int(351920) int(351920) int(351920) int(351920) int(351920)
Output for 7.0.0 - 7.0.33
int(351592) int(351944) int(351944) int(351944) int(351944) int(351944)
Output for 5.6.0 - 5.6.40
int(226040) int(226288) int(226376) int(226464) int(226552) int(226640)
Output for 5.5.0 - 5.5.38
int(226032) int(226264) int(226352) int(226440) int(226528) int(226616)
Output for 5.4.10 - 5.4.45
int(226544) int(226776) int(226864) int(226952) int(227048) int(227136)
Output for 5.4.0 - 5.4.9
int(226544) int(226776) int(226864) int(226952) int(227040) int(227128)
Output for 5.3.11 - 5.3.29
int(629920) int(630040) int(630128) int(630216) int(630304) int(630392)
Output for 5.3.0 - 5.3.10
int(629616) int(629736) int(629824) int(629912) int(630000) int(630088)
Output for 5.1.0 - 5.1.6, 5.2.0 - 5.2.17
Parse error: syntax error, unexpected T_PAAMAYIM_NEKUDOTAYIM, expecting T_VARIABLE in /in/ppNPk on line 18
Process exited with code 255.
Output for 5.0.0 - 5.0.5
Parse error: parse error, unexpected T_PAAMAYIM_NEKUDOTAYIM, expecting T_VARIABLE in /in/ppNPk 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/ppNPk 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/ppNPk 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/ppNPk on line 6
Process exited with code 255.

preferences:
223.76 ms | 401 KiB | 322 Q