3v4l.org

run code in 300+ PHP versions simultaneously
<?php $urls = array(); $urls[] = "data://text/plain,foo\r\nbar\r\n"; $urls[] = "data://text/plain,\r\nfoo\r\nbar\r\n"; $urls[] = "data://text/plain,foo\r\nbar"; foreach($urls as $url) { echo strtr($url, array("\r" => "\\r", "\n" => "\\n")) . "\n"; var_dump(file($url, FILE_IGNORE_NEW_LINES)); } ?>
Output for 5.2.10 - 5.2.17, 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 5.5.0 - 5.5.38, 5.6.0 - 5.6.40, 7.0.0 - 7.0.33, 7.1.0 - 7.1.33, 7.2.0 - 7.2.34, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.4, 8.3.6
data://text/plain,foo\r\nbar\r\n array(2) { [0]=> string(3) "foo" [1]=> string(3) "bar" } data://text/plain,\r\nfoo\r\nbar\r\n array(3) { [0]=> string(0) "" [1]=> string(3) "foo" [2]=> string(3) "bar" } data://text/plain,foo\r\nbar array(2) { [0]=> string(3) "foo" [1]=> string(3) "bar" }
Output for 8.3.5
Warning: PHP Startup: Unable to load dynamic library 'sodium.so' (tried: /usr/lib/php/8.3.5/modules/sodium.so (libsodium.so.23: cannot open shared object file: No such file or directory), /usr/lib/php/8.3.5/modules/sodium.so.so (/usr/lib/php/8.3.5/modules/sodium.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0 data://text/plain,foo\r\nbar\r\n array(2) { [0]=> string(3) "foo" [1]=> string(3) "bar" } data://text/plain,\r\nfoo\r\nbar\r\n array(3) { [0]=> string(0) "" [1]=> string(3) "foo" [2]=> string(3) "bar" } data://text/plain,foo\r\nbar array(2) { [0]=> string(3) "foo" [1]=> string(3) "bar" }
Output for 5.2.0 - 5.2.9
data://text/plain,foo\r\nbar\r\n array(2) { [0]=> string(4) "foo " [1]=> string(4) "bar " } data://text/plain,\r\nfoo\r\nbar\r\n array(3) { [0]=> string(1) " " [1]=> string(4) "foo " [2]=> string(4) "bar " } data://text/plain,foo\r\nbar array(2) { [0]=> string(4) "foo " [1]=> string(3) "bar" }
Output for 5.0.0 - 5.0.5, 5.1.0 - 5.1.6
data://text/plain,foo\r\nbar\r\n Notice: file(): Unable to find the wrapper "data" - did you forget to enable it when you configured PHP? in /in/eA9gM on line 10 Warning: file(data://text/plain,foo bar ): failed to open stream: No such file or directory in /in/eA9gM on line 10 bool(false) data://text/plain,\r\nfoo\r\nbar\r\n Notice: file(): Unable to find the wrapper "data" - did you forget to enable it when you configured PHP? in /in/eA9gM on line 10 Warning: file(data://text/plain, foo bar ): failed to open stream: No such file or directory in /in/eA9gM on line 10 bool(false) data://text/plain,foo\r\nbar Notice: file(): Unable to find the wrapper "data" - did you forget to enable it when you configured PHP? in /in/eA9gM on line 10 Warning: file(data://text/plain,foo bar): failed to open stream: No such file or directory in /in/eA9gM on line 10 bool(false)
Output for 4.3.2 - 4.3.11, 4.4.0 - 4.4.9
data://text/plain,foo\r\nbar\r\n Notice: Use of undefined constant FILE_IGNORE_NEW_LINES - assumed 'FILE_IGNORE_NEW_LINES' in /in/eA9gM on line 10 Notice: file(): Unable to find the wrapper "data" - did you forget to enable it when you configured PHP? in /in/eA9gM on line 10 Warning: file(data://text/plain,foo bar ): failed to open stream: No such file or directory in /in/eA9gM on line 10 bool(false) data://text/plain,\r\nfoo\r\nbar\r\n Notice: Use of undefined constant FILE_IGNORE_NEW_LINES - assumed 'FILE_IGNORE_NEW_LINES' in /in/eA9gM on line 10 Notice: file(): Unable to find the wrapper "data" - did you forget to enable it when you configured PHP? in /in/eA9gM on line 10 Warning: file(data://text/plain, foo bar ): failed to open stream: No such file or directory in /in/eA9gM on line 10 bool(false) data://text/plain,foo\r\nbar Notice: Use of undefined constant FILE_IGNORE_NEW_LINES - assumed 'FILE_IGNORE_NEW_LINES' in /in/eA9gM on line 10 Notice: file(): Unable to find the wrapper "data" - did you forget to enable it when you configured PHP? in /in/eA9gM on line 10 Warning: file(data://text/plain,foo bar): failed to open stream: No such file or directory in /in/eA9gM on line 10 bool(false)
Output for 4.3.0 - 4.3.1
data://text/plain,foo\r\nbar\r\n Notice: Use of undefined constant FILE_IGNORE_NEW_LINES - assumed 'FILE_IGNORE_NEW_LINES' in /in/eA9gM on line 10 Notice: file() [http://www.php.net/function.file]: Unable to find the wrapper "data" - did you forget to enable it when you configured PHP? in /in/eA9gM on line 10 Warning: file(data://text/plain,foo bar ) [http://www.php.net/function.file]: failed to create stream: No such file or directory in /in/eA9gM on line 10 bool(false) data://text/plain,\r\nfoo\r\nbar\r\n Notice: Use of undefined constant FILE_IGNORE_NEW_LINES - assumed 'FILE_IGNORE_NEW_LINES' in /in/eA9gM on line 10 Notice: file() [http://www.php.net/function.file]: Unable to find the wrapper "data" - did you forget to enable it when you configured PHP? in /in/eA9gM on line 10 Warning: file(data://text/plain, foo bar ) [http://www.php.net/function.file]: failed to create stream: No such file or directory in /in/eA9gM on line 10 bool(false) data://text/plain,foo\r\nbar Notice: Use of undefined constant FILE_IGNORE_NEW_LINES - assumed 'FILE_IGNORE_NEW_LINES' in /in/eA9gM on line 10 Notice: file() [http://www.php.net/function.file]: Unable to find the wrapper "data" - did you forget to enable it when you configured PHP? in /in/eA9gM on line 10 Warning: file(data://text/plain,foo bar) [http://www.php.net/function.file]: failed to create stream: No such file or directory in /in/eA9gM on line 10 bool(false)

preferences:
324.02 ms | 404 KiB | 465 Q