3v4l.org

run code in 300+ PHP versions simultaneously
<?php $code = array_map( function ($line) { return $line ? ' '.$line : $line; }, explode("\n", $code) ); return sprintf( "if (%s)\n{\n%s}\n", implode(' && ', $conditions), $code );
Output for 8.1.24 - 8.1.27, 8.2.11 - 8.2.18, 8.3.0 - 8.3.4, 8.3.6
Warning: Undefined variable $code in /in/6tcFf on line 7 Deprecated: explode(): Passing null to parameter #2 ($string) of type string is deprecated in /in/6tcFf on line 7 Warning: Undefined variable $conditions in /in/6tcFf on line 11 Fatal error: Uncaught TypeError: implode(): Argument #1 ($array) must be of type array, string given in /in/6tcFf:11 Stack trace: #0 /in/6tcFf(11): implode(' && ', NULL) #1 {main} thrown in /in/6tcFf on line 11
Process exited with code 255.
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 Warning: Undefined variable $code in /in/6tcFf on line 7 Deprecated: explode(): Passing null to parameter #2 ($string) of type string is deprecated in /in/6tcFf on line 7 Warning: Undefined variable $conditions in /in/6tcFf on line 11 Fatal error: Uncaught TypeError: implode(): Argument #1 ($array) must be of type array, string given in /in/6tcFf:11 Stack trace: #0 /in/6tcFf(11): implode(' && ', NULL) #1 {main} thrown in /in/6tcFf on line 11
Process exited with code 255.
Output for 8.1.0 - 8.1.23, 8.2.0 - 8.2.10
Warning: Undefined variable $code in /in/6tcFf on line 7 Deprecated: explode(): Passing null to parameter #2 ($string) of type string is deprecated in /in/6tcFf on line 7 Warning: Undefined variable $conditions in /in/6tcFf on line 11 Fatal error: Uncaught TypeError: implode(): Argument #1 ($pieces) must be of type array, string given in /in/6tcFf:11 Stack trace: #0 /in/6tcFf(11): implode(' && ', NULL) #1 {main} thrown in /in/6tcFf on line 11
Process exited with code 255.
Output for 8.0.0 - 8.0.30
Warning: Undefined variable $code in /in/6tcFf on line 7 Warning: Undefined variable $conditions in /in/6tcFf on line 11 Fatal error: Uncaught TypeError: implode(): Argument #1 ($pieces) must be of type array, string given in /in/6tcFf:11 Stack trace: #0 /in/6tcFf(11): implode(' && ', NULL) #1 {main} thrown in /in/6tcFf on line 11
Process exited with code 255.
Output for 7.0.20, 7.1.5 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.31, 7.4.0 - 7.4.33
Notice: Undefined variable: code in /in/6tcFf on line 7 Notice: Undefined variable: conditions in /in/6tcFf on line 11 Warning: implode(): Invalid arguments passed in /in/6tcFf on line 11 Notice: Array to string conversion in /in/6tcFf on line 12
Output for 7.3.32 - 7.3.33
Warning: implode(): Invalid arguments passed in /in/6tcFf on line 11
Output for 7.0.0 - 7.0.6, 7.1.0
Notice: Undefined variable: code in /in/6tcFf on line 7 Notice: Undefined variable: conditions in /in/6tcFf on line 11 Warning: implode(): Invalid arguments passed in /in/6tcFf on line 11 Notice: Array to string conversion in /in/6tcFf on line 11
Output for 5.4.9 - 5.4.45, 5.5.24 - 5.5.35, 5.6.8 - 5.6.28
Notice: Undefined variable: code in /in/6tcFf on line 7 Notice: Undefined variable: conditions in /in/6tcFf on line 11 Warning: implode(): Invalid arguments passed in /in/6tcFf on line 11 Notice: Array to string conversion in /in/6tcFf on line 13

preferences:
195.79 ms | 402 KiB | 248 Q