3v4l.org

run code in 300+ PHP versions simultaneously
<?php // Set these right at the top! ini_set('display_errors', 'On'); error_reporting(-1); session_start(); include '../connect.php'; $_SESSION['db'] = 'concorso'; //name of database $_SESSION['quiz']='simulazione'; //name of table $_SESSION['quiz_id'] = 2; //generates casual numbers $sql = "SELECT COUNT(*) FROM {$_SESSION['quiz']}"; $stmt = $dbh->prepare($sql); $stmt->execute(); $rows = $stmt->fetch(PDO::FETCH_NUM); //Number of rows in table $_SESSION['numbers'] = range(1, $rows[0]); shuffle($_SESSION['numbers']); echo $rows[0]; ?> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>Test Page</title> </head> <body> </body> </html>
Output for 7.0.5 - 7.0.33, 7.1.0 - 7.1.33, 7.2.0 - 7.2.26, 7.3.0 - 7.3.13, 7.4.0 - 7.4.1
Warning: include(): open_basedir restriction in effect. File(../connect.php) is not within the allowed path(s): (/tmp:/in:/etc) in /in/otDJW on line 8 Warning: include(../connect.php): failed to open stream: Operation not permitted in /in/otDJW on line 8 Warning: include(): Failed opening '../connect.php' for inclusion (include_path='.:') in /in/otDJW on line 8 Notice: Undefined variable: dbh in /in/otDJW on line 15 Fatal error: Uncaught Error: Call to a member function prepare() on null in /in/otDJW:15 Stack trace: #0 {main} thrown in /in/otDJW on line 15
Process exited with code 255.
Output for 7.0.0 - 7.0.4
Warning: include(): open_basedir restriction in effect. File(../connect.php) is not within the allowed path(s): (/tmp:/in:/etc) in /in/otDJW on line 8 Warning: include(../connect.php): failed to open stream: Operation not permitted in /in/otDJW on line 8 Warning: include(): Failed opening '../connect.php' for inclusion (include_path='.:') in /in/otDJW on line 8 Notice: Undefined variable: dbh in /in/otDJW on line 15 Fatal error: Uncaught Error: Call to a member function prepare() on unknown in /in/otDJW:15 Stack trace: #0 {main} thrown in /in/otDJW on line 15
Process exited with code 255.
Output for 5.6.0 - 5.6.40
Warning: include(): open_basedir restriction in effect. File(../connect.php) is not within the allowed path(s): (/tmp:/in:/etc) in /in/otDJW on line 8 Warning: include(../connect.php): failed to open stream: Operation not permitted in /in/otDJW on line 8 Warning: include(): Failed opening '../connect.php' for inclusion (include_path='.:') in /in/otDJW on line 8 Notice: Undefined variable: dbh in /in/otDJW on line 15 Fatal error: Call to a member function prepare() on null in /in/otDJW on line 15
Process exited with code 255.

preferences:
115.63 ms | 402 KiB | 157 Q