3v4l.org

run code in 300+ PHP versions simultaneously
<?php $s_con = array_values(array_filter(file('count.txt'), create_function('$a', 'return rtrim($a) != "~";'))); $index = file_get_contents('count_index.txt'); file_put_contents('count_index.txt', ($index + 1) % count($s_con)); // PHP5 echo $s_con[$index]; var_dump(($index + 1) % count($s_con));
Output for 8.0.0 - 8.0.12, 8.0.14 - 8.0.30, 8.1.0 - 8.1.27, 8.2.0 - 8.2.17, 8.3.0 - 8.3.4
Warning: file(): open_basedir restriction in effect. File(count.txt) is not within the allowed path(s): (/tmp:/in:/etc) in /in/CvGFb on line 2 Warning: file(count.txt): Failed to open stream: Operation not permitted in /in/CvGFb on line 2 Fatal error: Uncaught Error: Call to undefined function create_function() in /in/CvGFb:3 Stack trace: #0 {main} thrown in /in/CvGFb on line 3
Process exited with code 255.
Output for 8.0.13
Warning: file(count.txt): Failed to open stream: No such file or directory in /in/CvGFb on line 2 Fatal error: Uncaught Error: Call to undefined function create_function() in /in/CvGFb:3 Stack trace: #0 {main} thrown in /in/CvGFb on line 3
Process exited with code 255.
Output for 7.4.33
Warning: file(count.txt): failed to open stream: No such file or directory in /in/CvGFb on line 2 Deprecated: Function create_function() is deprecated in /in/CvGFb on line 3 Warning: array_filter() expects parameter 1 to be array, bool given in /in/CvGFb on line 3 Warning: array_values() expects parameter 1 to be array, null given in /in/CvGFb on line 3 Warning: file_get_contents(count_index.txt): failed to open stream: No such file or directory in /in/CvGFb on line 5 Warning: count(): Parameter must be an array or an object that implements Countable in /in/CvGFb on line 6 Fatal error: Uncaught DivisionByZeroError: Modulo by zero in /in/CvGFb:6 Stack trace: #0 {main} thrown in /in/CvGFb on line 6
Process exited with code 255.
Output for 7.3.0 - 7.3.31, 7.4.0 - 7.4.25, 7.4.27 - 7.4.32
Warning: file(): open_basedir restriction in effect. File(count.txt) is not within the allowed path(s): (/tmp:/in:/etc) in /in/CvGFb on line 2 Warning: file(count.txt): failed to open stream: Operation not permitted in /in/CvGFb on line 2 Deprecated: Function create_function() is deprecated in /in/CvGFb on line 3 Warning: array_filter() expects parameter 1 to be array, bool given in /in/CvGFb on line 3 Warning: array_values() expects parameter 1 to be array, null given in /in/CvGFb on line 3 Warning: file_get_contents(): open_basedir restriction in effect. File(count_index.txt) is not within the allowed path(s): (/tmp:/in:/etc) in /in/CvGFb on line 5 Warning: file_get_contents(count_index.txt): failed to open stream: Operation not permitted in /in/CvGFb on line 5 Warning: count(): Parameter must be an array or an object that implements Countable in /in/CvGFb on line 6 Fatal error: Uncaught DivisionByZeroError: Modulo by zero in /in/CvGFb:6 Stack trace: #0 {main} thrown in /in/CvGFb on line 6
Process exited with code 255.
Output for 7.3.32 - 7.3.33, 7.4.26
Warning: file(count.txt): failed to open stream: No such file or directory in /in/CvGFb on line 2 Warning: array_filter() expects parameter 1 to be array, bool given in /in/CvGFb on line 3 Warning: array_values() expects parameter 1 to be array, null given in /in/CvGFb on line 3 Warning: file_get_contents(count_index.txt): failed to open stream: No such file or directory in /in/CvGFb on line 5 Warning: count(): Parameter must be an array or an object that implements Countable in /in/CvGFb on line 6 Fatal error: Uncaught DivisionByZeroError: Modulo by zero in /in/CvGFb:6 Stack trace: #0 {main} thrown in /in/CvGFb on line 6
Process exited with code 255.
Output for 7.2.0 - 7.2.33
Warning: file(): open_basedir restriction in effect. File(count.txt) is not within the allowed path(s): (/tmp:/in:/etc) in /in/CvGFb on line 2 Warning: file(count.txt): failed to open stream: Operation not permitted in /in/CvGFb on line 2 Deprecated: Function create_function() is deprecated in /in/CvGFb on line 3 Warning: array_filter() expects parameter 1 to be array, boolean given in /in/CvGFb on line 3 Warning: array_values() expects parameter 1 to be array, null given in /in/CvGFb on line 3 Warning: file_get_contents(): open_basedir restriction in effect. File(count_index.txt) is not within the allowed path(s): (/tmp:/in:/etc) in /in/CvGFb on line 5 Warning: file_get_contents(count_index.txt): failed to open stream: Operation not permitted in /in/CvGFb on line 5 Warning: count(): Parameter must be an array or an object that implements Countable in /in/CvGFb on line 6 Fatal error: Uncaught DivisionByZeroError: Modulo by zero in /in/CvGFb:6 Stack trace: #0 {main} thrown in /in/CvGFb on line 6
Process exited with code 255.
Output for 7.1.25
Warning: file(): open_basedir restriction in effect. File(count.txt) is not within the allowed path(s): (/tmp:/in:/etc) in /in/CvGFb on line 2 Warning: file(count.txt): failed to open stream: Operation not permitted in /in/CvGFb on line 2 Warning: array_filter() expects parameter 1 to be array, boolean given in /in/CvGFb on line 3 Warning: array_values() expects parameter 1 to be array, null given in /in/CvGFb on line 3 Warning: file_get_contents(): open_basedir restriction in effect. File(count_index.txt) is not within the allowed path(s): (/tmp:/in:/etc) in /in/CvGFb on line 5 Warning: file_get_contents(count_index.txt): failed to open stream: Operation not permitted in /in/CvGFb on line 5 Fatal error: Uncaught DivisionByZeroError: Modulo by zero in /in/CvGFb:6 Stack trace: #0 {main} thrown in /in/CvGFb on line 6
Process exited with code 255.
Output for 7.1.20
Warning: file(): open_basedir restriction in effect. File(count.txt) is not within the allowed path(s): (/tmp:/in) in /in/CvGFb on line 2 Warning: file(count.txt): failed to open stream: Operation not permitted in /in/CvGFb on line 2 Warning: array_filter() expects parameter 1 to be array, boolean given in /in/CvGFb on line 3 Warning: array_values() expects parameter 1 to be array, null given in /in/CvGFb on line 3 Warning: file_get_contents(): open_basedir restriction in effect. File(count_index.txt) is not within the allowed path(s): (/tmp:/in) in /in/CvGFb on line 5 Warning: file_get_contents(count_index.txt): failed to open stream: Operation not permitted in /in/CvGFb on line 5 Fatal error: Uncaught DivisionByZeroError: Modulo by zero in /in/CvGFb:6 Stack trace: #0 {main} thrown in /in/CvGFb on line 6
Process exited with code 255.
Output for 7.0.0 - 7.0.20, 7.1.0 - 7.1.10
Warning: file(count.txt): failed to open stream: No such file or directory in /in/CvGFb on line 2 Warning: array_filter() expects parameter 1 to be array, boolean given in /in/CvGFb on line 3 Warning: array_values() expects parameter 1 to be array, null given in /in/CvGFb on line 3 Warning: file_get_contents(count_index.txt): failed to open stream: No such file or directory in /in/CvGFb on line 5 Fatal error: Uncaught DivisionByZeroError: Modulo by zero in /in/CvGFb:6 Stack trace: #0 {main} thrown in /in/CvGFb on line 6
Process exited with code 255.
Output for 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 5.5.24 - 5.5.35, 5.6.8 - 5.6.28
Warning: file(count.txt): failed to open stream: No such file or directory in /in/CvGFb on line 2 Warning: array_filter() expects parameter 1 to be array, boolean given in /in/CvGFb on line 3 Warning: array_values() expects parameter 1 to be array, null given in /in/CvGFb on line 3 Warning: file_get_contents(count_index.txt): failed to open stream: No such file or directory in /in/CvGFb on line 5 Warning: Division by zero in /in/CvGFb on line 6 Warning: file_put_contents(count_index.txt): failed to open stream: Permission denied in /in/CvGFb on line 6 Warning: Division by zero in /in/CvGFb on line 9 bool(false)
Output for 5.2.3 - 5.2.17
Warning: file(count.txt): failed to open stream: No such file or directory in /in/CvGFb on line 2 Warning: array_filter(): The first argument should be an array in /in/CvGFb on line 3 Warning: array_values(): The argument should be an array in /in/CvGFb on line 3 Warning: file_get_contents(count_index.txt): failed to open stream: No such file or directory in /in/CvGFb on line 5 Warning: Division by zero in /in/CvGFb on line 6 Warning: file_put_contents(count_index.txt): failed to open stream: Permission denied in /in/CvGFb on line 6 Warning: Division by zero in /in/CvGFb on line 9 bool(false)
Output for 5.2.0 - 5.2.2
Warning: file(count.txt): failed to open stream: No such file or directory in /in/CvGFb on line 2 Warning: array_filter(): The first argument should be an array in /in/CvGFb on line 3 Warning: array_values(): The argument should be an array in /in/CvGFb on line 3 Warning: file_get_contents(count_index.txt): failed to open stream: No such file or directory in /in/CvGFb on line 5 Warning: Division by zero in /in/CvGFb on line 6 Warning: file_put_contents(count_index.txt): failed to open stream: Read-only file system in /in/CvGFb on line 6 Warning: Division by zero in /in/CvGFb on line 9 bool(false)
Output for 5.0.0 - 5.0.5, 5.1.0 - 5.1.6
Warning: file(count.txt): failed to open stream: No such file or directory in /in/CvGFb on line 2 Warning: array_filter(): The first argument should be an array in /in/CvGFb on line 3 Warning: array_values(): The argument should be an array in /in/CvGFb on line 3 Warning: file_get_contents(count_index.txt): failed to open stream: No such file or directory in /in/CvGFb on line 5 Warning: file_put_contents(count_index.txt): failed to open stream: Read-only file system in /in/CvGFb on line 6 bool(false)
Output for 4.4.5 - 4.4.9
Warning: file(count.txt): failed to open stream: No such file or directory in /in/CvGFb on line 2 Warning: array_filter(): The first argument should be an array in /in/CvGFb on line 3 Warning: array_values(): The argument should be an array in /in/CvGFb on line 3 Warning: file_get_contents(count_index.txt): failed to open stream: No such file or directory in /in/CvGFb on line 5 Fatal error: Call to undefined function: file_put_contents() in /in/CvGFb on line 6
Process exited with code 255.
Output for 4.3.2 - 4.3.11, 4.4.0 - 4.4.4
Warning: file(count.txt): failed to open stream: No such file or directory in /in/CvGFb on line 2 Warning: array_filter(): The first argument should be an array in /in/CvGFb on line 3 Warning: array_values(): The argument should be an array in /in/CvGFb on line 3 Warning: file_get_contents(count_index.txt): failed to open stream: No such file or directory in /in/CvGFb on line 5 Fatal error: Call to undefined function: file_put_contents() in /in/CvGFb on line 6
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Warning: file(count.txt) [http://www.php.net/function.file]: failed to create stream: No such file or directory in /in/CvGFb on line 2 Warning: array_filter() [http://www.php.net/function.array-filter]: The first argument should be an array in /in/CvGFb on line 3 Warning: array_values() [http://www.php.net/function.array-values]: The argument should be an array in /in/CvGFb on line 3 Warning: file_get_contents(count_index.txt) [http://www.php.net/function.file-get-contents]: failed to create stream: No such file or directory in /in/CvGFb on line 5 Fatal error: Call to undefined function: file_put_contents() in /in/CvGFb on line 6

preferences:
235.59 ms | 402 KiB | 325 Q