3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php class File { // "Resource(stream)" isn't all that useful private $fp; // But all the stream meta data is public function __debugInfo() { echo'11111111111'; return $this->fp ? stream_get_meta_data($fp) : []; } public function open($filename, $mode = 'r'){ $this->fp = fopen($filename, $mode); } } $f = new File; var_dump($f); // object(File)#1 { } $f->open('http://php.net'); var_dump($f);
Output for 5.6.7 - 5.6.17, 5.6.20 - 7.0.3, 7.0.5 - 7.1.0
11111111111object(File)#1 (0) { } Warning: fopen(): php_network_getaddresses: getaddrinfo failed: Name or service not known in /in/ScFpR on line 13 Warning: fopen(http://php.net): failed to open stream: php_network_getaddresses: getaddrinfo failed: Name or service not known in /in/ScFpR on line 13 11111111111object(File)#1 (0) { }
Output for 5.6.18 - 5.6.19, 7.0.4
11111111111object(File)#1 (0) { } Warning: fopen(): php_network_getaddresses: getaddrinfo failed: System error in /in/ScFpR on line 13 Warning: fopen(http://php.net): failed to open stream: php_network_getaddresses: getaddrinfo failed: System error in /in/ScFpR on line 13 11111111111object(File)#1 (0) { }
Output for 5.4.26 - 5.4.40, 5.5.24 - 5.5.32, 5.5.34 - 5.5.35
object(File)#1 (1) { ["fp":"File":private]=> NULL } Warning: fopen(): php_network_getaddresses: getaddrinfo failed: Name or service not known in /in/ScFpR on line 13 Warning: fopen(http://php.net): failed to open stream: php_network_getaddresses: getaddrinfo failed: Name or service not known in /in/ScFpR on line 13 object(File)#1 (1) { ["fp":"File":private]=> bool(false) }
Output for 5.4.0 - 5.4.25, 5.4.41 - 5.4.45, 5.5.33
object(File)#1 (1) { ["fp":"File":private]=> NULL } Warning: fopen(): php_network_getaddresses: getaddrinfo failed: System error in /in/ScFpR on line 13 Warning: fopen(http://php.net): failed to open stream: php_network_getaddresses: getaddrinfo failed: System error in /in/ScFpR on line 13 object(File)#1 (1) { ["fp":"File":private]=> bool(false) }
Output for 5.1.0 - 5.3.29
Parse error: syntax error, unexpected '[' in /in/ScFpR on line 9
Process exited with code 255.
Output for 5.0.0 - 5.0.5
Parse error: parse error, unexpected '[' in /in/ScFpR on line 9
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/ScFpR on line 4
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/ScFpR on line 4
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/ScFpR on line 4
Process exited with code 255.