3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?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.1.0
int(351640) int(351992) int(351992) int(351992) int(351992) int(351992)
Output for 7.0.0 - 7.0.14
int(351664) int(352016) int(352016) int(352016) int(352016) int(352016)
Output for hhvm-3.10.0 - 3.12.0
int(2097152) int(2097152) int(2097152) int(2097152) int(2097152) int(2097152)
Output for 5.6.0 - 5.6.28
int(226224) int(226472) int(226560) int(226648) int(226736) int(226824)
Output for 5.5.0 - 5.5.38
int(226216) int(226448) int(226536) int(226624) int(226712) int(226800)
Output for 5.4.10 - 5.4.45
int(226728) int(226960) int(227048) int(227136) int(227232) int(227320)
Output for 5.4.0 - 5.4.9
int(226728) int(226960) int(227048) int(227136) int(227224) int(227312)
Output for 5.3.11 - 5.3.29
int(630464) int(630584) int(630672) int(630760) int(630848) int(630936)
Output for 5.3.0 - 5.3.10
int(630160) int(630280) int(630368) int(630456) int(630544) int(630632)
Output for 5.1.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.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.