3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $url = "https://picsum.photos/200/300"; $stream = tmpfile(); fwrite($stream, file_get_contents($url)); rewind($stream); $meta = stream_get_meta_data($stream); $basename = basename($url); $filename = $basename; if (false !== mb_strpos($basename, '?')) { $filename = mb_substr($basename, 0, mb_strpos($basename, '?')); } var_dump($filename);
Output for 7.3.0alpha1 - 7.3.0beta1
Warning: file_get_contents(): Unable to find the wrapper "https" - did you forget to enable it when you configured PHP? in /in/bmkVp on line 6 Warning: file_get_contents(https://picsum.photos/200/300): failed to open stream: No such file or directory in /in/bmkVp on line 6 string(3) "300"
Output for 7.2.11
Warning: file_get_contents(): Unable to find the wrapper "https" - did you forget to enable it when you configured PHP? in /in/bmkVp on line 6 Warning: file_get_contents(): open_basedir restriction in effect. File(https://picsum.photos/200/300) is not within the allowed path(s): (/tmp:/in:/etc) in /in/bmkVp on line 6 Warning: file_get_contents(https://picsum.photos/200/300): failed to open stream: Operation not permitted in /in/bmkVp on line 6 string(3) "300"
Output for 5.6.30, 7.0.30 - 7.2.7
Warning: file_get_contents(): Unable to find the wrapper "https" - did you forget to enable it when you configured PHP? in /in/bmkVp on line 6 Warning: file_get_contents(): open_basedir restriction in effect. File(https://picsum.photos/200/300) is not within the allowed path(s): (/tmp:/in) in /in/bmkVp on line 6 Warning: file_get_contents(https://picsum.photos/200/300): failed to open stream: Operation not permitted in /in/bmkVp on line 6 string(3) "300"
Output for hhvm-3.22.0
Warning: Failed to open https://picsum.photos/200/300 (Could not resolve host: picsum.photos) in /in/bmkVp on line -1 string(3) "300"
Output for hhvm-3.18.5 - 3.21.3
Warning: Failed to open https://picsum.photos/200/300 (Could not resolve host: picsum.photos) in /in/bmkVp on line 6 string(3) "300"