3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $var = 'http://sandbox.case-store.ch/images/27-12-2014 13-50-47.png'; $var2 = 'sandbox.case-store.ch/images/27-12-2014 13-50-47.png'; function getImageContentRaw($url) { try { echo 'Stage0'; return file_get_contents(rawurlencode($url)); } catch (PHPException $ex) { // Ignore error and try http and https prefix } if (substr($url, 0, 7) === 'http://' || substr($url, 0, 7) === 'https://') { echo 'Stage9'; return false; } try { echo 'Stage1'; return file_get_contents(urlencode('https://'.$url)); } catch (PHPException $ex) { // Ignore error } try { echo 'Stage2'; return file_get_contents(urlencode('http://' . $url)); } catch (PHPException $ex) { // Ignore error } echo 'Stage8'; return false; } var_dump(getImageContentRaw($var)); var_dump(getImageContentRaw($var2));
based on RRBJR
Output for 5.0.0 - 7.2.0
Stage0 Warning: file_get_contents(http%3A%2F%2Fsandbox.case-store.ch%2Fimages%2F27-12-2014%2013-50-47.png): failed to open stream: No such file or directory in /in/f0AO2 on line 9 bool(false) Stage0 Warning: file_get_contents(sandbox.case-store.ch%2Fimages%2F27-12-2014%2013-50-47.png): failed to open stream: No such file or directory in /in/f0AO2 on line 9 bool(false)
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected '{' in /in/f0AO2 on line 7
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1
Parse error: parse error, unexpected '{' in /in/f0AO2 on line 7
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/f0AO2 on line 7
Process exited with code 255.