3v4l.org

run code in 300+ PHP versions simultaneously
<?php /* +-------------------------------------------------------------+ | Copyright (c) 2015 Facebook, Inc. (http://www.facebook.com) | +-------------------------------------------------------------+ */ error_reporting(-1); ///* // $result = `dir *.*`; $result = `ls`; var_dump($result); //*/ ///* // $result = `dir *.* >dirlist.txt`; $result = `ls >dirlist.txt`; var_dump($result); unlink('dirlist.txt'); //*/ ///* $d = "dir"; $f = "*.*"; // $result = `$d {$f}`; $result = `ls`; var_dump($result); //*/ ///* $result = ``; var_dump($result); $result = ` `; var_dump($result); //*/
Output for 8.5.0
Deprecated: The backtick (`) operator is deprecated, use shell_exec() instead in /in/MmEm7 on line 13 Deprecated: The backtick (`) operator is deprecated, use shell_exec() instead in /in/MmEm7 on line 19 Deprecated: The backtick (`) operator is deprecated, use shell_exec() instead in /in/MmEm7 on line 28 Deprecated: The backtick (`) operator is deprecated, use shell_exec() instead in /in/MmEm7 on line 33 Deprecated: The backtick (`) operator is deprecated, use shell_exec() instead in /in/MmEm7 on line 36 Warning: shell_exec(): Unable to execute 'ls' in /in/MmEm7 on line 13 bool(false) Warning: shell_exec(): Unable to execute 'ls >dirlist.txt' in /in/MmEm7 on line 19 bool(false) Warning: unlink(): open_basedir restriction in effect. File(dirlist.txt) is not within the allowed path(s): (/tmp:/in:/etc) in /in/MmEm7 on line 21 Warning: shell_exec(): Unable to execute 'ls' in /in/MmEm7 on line 28 bool(false) Fatal error: Uncaught ValueError: shell_exec(): Argument #1 ($command) must not be empty in /in/MmEm7:33 Stack trace: #0 /in/MmEm7(33): shell_exec('') #1 {main} thrown in /in/MmEm7 on line 33
Process exited with code 255.
Output for 8.4.15
/bin/php-8.4.15: /usr/lib/libm.so.6: version `GLIBC_2.38' not found (required by /bin/php-8.4.15) /bin/php-8.4.15: /usr/lib/libm.so.6: version `GLIBC_2.35' not found (required by /bin/php-8.4.15) /bin/php-8.4.15: /usr/lib/libc.so.6: version `GLIBC_2.34' not found (required by /bin/php-8.4.15) /bin/php-8.4.15: /usr/lib/libc.so.6: version `GLIBC_2.38' not found (required by /bin/php-8.4.15)
Process exited with code 1.
Output for 8.4.1 - 8.4.14
Warning: shell_exec(): Unable to execute 'ls' in /in/MmEm7 on line 13 bool(false) Warning: shell_exec(): Unable to execute 'ls >dirlist.txt' in /in/MmEm7 on line 19 bool(false) Warning: unlink(): open_basedir restriction in effect. File(dirlist.txt) is not within the allowed path(s): (/tmp:/in:/etc) in /in/MmEm7 on line 21 Warning: shell_exec(): Unable to execute 'ls' in /in/MmEm7 on line 28 bool(false) Fatal error: Uncaught ValueError: shell_exec(): Argument #1 ($command) must not be empty in /in/MmEm7:33 Stack trace: #0 /in/MmEm7(33): shell_exec('') #1 {main} thrown in /in/MmEm7 on line 33
Process exited with code 255.
Output for 8.0.0 - 8.0.12, 8.0.14 - 8.0.30, 8.1.0 - 8.1.33, 8.2.0 - 8.2.29, 8.3.0 - 8.3.28
Warning: shell_exec(): Unable to execute 'ls' in /in/MmEm7 on line 13 bool(false) Warning: shell_exec(): Unable to execute 'ls >dirlist.txt' in /in/MmEm7 on line 19 bool(false) Warning: unlink(): open_basedir restriction in effect. File(dirlist.txt) is not within the allowed path(s): (/tmp:/in:/etc) in /in/MmEm7 on line 21 Warning: shell_exec(): Unable to execute 'ls' in /in/MmEm7 on line 28 bool(false) Fatal error: Uncaught ValueError: shell_exec(): Argument #1 ($command) cannot be empty in /in/MmEm7:33 Stack trace: #0 /in/MmEm7(33): shell_exec('') #1 {main} thrown in /in/MmEm7 on line 33
Process exited with code 255.
Output for 8.0.13
Warning: shell_exec(): Unable to execute 'ls' in /in/MmEm7 on line 13 bool(false) Warning: shell_exec(): Unable to execute 'ls >dirlist.txt' in /in/MmEm7 on line 19 bool(false) Warning: unlink(dirlist.txt): Read-only file system in /in/MmEm7 on line 21 Warning: shell_exec(): Unable to execute 'ls' in /in/MmEm7 on line 28 bool(false) Fatal error: Uncaught ValueError: shell_exec(): Argument #1 ($command) cannot be empty in /in/MmEm7:33 Stack trace: #0 /in/MmEm7(33): shell_exec('') #1 {main} thrown in /in/MmEm7 on line 33
Process exited with code 255.
Output for 7.3.32 - 7.3.33, 7.4.33
Warning: shell_exec(): Unable to execute 'ls' in /in/MmEm7 on line 13 bool(false) Warning: shell_exec(): Unable to execute 'ls >dirlist.txt' in /in/MmEm7 on line 19 bool(false) Warning: unlink(dirlist.txt): Read-only file system in /in/MmEm7 on line 21 Warning: shell_exec(): Unable to execute 'ls' in /in/MmEm7 on line 28 bool(false) Warning: shell_exec(): Cannot execute a blank command in /in/MmEm7 on line 33 bool(false) Warning: shell_exec(): Unable to execute ' ' in /in/MmEm7 on line 36 bool(false)
Output for 7.2.30 - 7.2.33, 7.3.17 - 7.3.31, 7.4.5 - 7.4.32
Warning: shell_exec(): Unable to execute 'ls' in /in/MmEm7 on line 13 bool(false) Warning: shell_exec(): Unable to execute 'ls >dirlist.txt' in /in/MmEm7 on line 19 bool(false) Warning: unlink(): open_basedir restriction in effect. File(dirlist.txt) is not within the allowed path(s): (/tmp:/in:/etc) in /in/MmEm7 on line 21 Warning: shell_exec(): Unable to execute 'ls' in /in/MmEm7 on line 28 bool(false) Warning: shell_exec(): Cannot execute a blank command in /in/MmEm7 on line 33 bool(false) Warning: shell_exec(): Unable to execute ' ' in /in/MmEm7 on line 36 bool(false)
Output for 7.2.29, 7.3.16, 7.4.3 - 7.4.4
Warning: shell_exec(): Unable to execute 'ls' in /in/MmEm7 on line 13 bool(false) Warning: shell_exec(): Unable to execute 'ls >dirlist.txt' in /in/MmEm7 on line 19 bool(false) Warning: unlink(): open_basedir restriction in effect. File(dirlist.txt) is not within the allowed path(s): (/tmp:/in:/etc) in /in/MmEm7 on line 21 Warning: shell_exec(): Unable to execute 'ls' in /in/MmEm7 on line 28 bool(false) Warning: shell_exec(): Unable to execute '' in /in/MmEm7 on line 33 bool(false) Warning: shell_exec(): Unable to execute ' ' in /in/MmEm7 on line 36 bool(false)
Output for 7.1.26 - 7.1.33, 7.2.17 - 7.2.25, 7.3.0 - 7.3.12, 7.4.0
NULL NULL Warning: unlink(): open_basedir restriction in effect. File(dirlist.txt) is not within the allowed path(s): (/tmp:/in:/etc) in /in/MmEm7 on line 21 NULL NULL NULL
Output for 5.6.0 - 5.6.25, 7.0.0 - 7.0.20, 7.1.0 - 7.1.7, 7.2.0
NULL NULL Warning: unlink(dirlist.txt): No such file or directory in /in/MmEm7 on line 21 NULL NULL NULL

preferences:
172.19 ms | 423 KiB | 5 Q