3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?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 7.0.0 - 7.1.0
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.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.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.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