3v4l.org

run code in 300+ PHP versions simultaneously
if ($_SERVER['REQUEST_METHOD'] == 'POST'){define('LIVE', FALSE);function my_error_handler ($e_number, $e_message, $e_file, $e_line, $e_vars) { $message = "An error occurred in script '$e_file' on line $e_line: $e_message\n"; $message .= print_r ($e_vars, 1); if (!LIVE) { echo '<pre>' . $message . "\n"; debug_print_backtrace(); echo '</pre><br />'; } else { echo '<div class="error">A system error occurred. We apologize for the inconvenience.</div><br />'; } }set_error_handler ('my_error_handler');$isbn = $_POST['ISBN'];$title = trim($_REQUEST['title']);$description = trim($_REQUEST['description']);$price = trim($_REQUEST['price']);$publisher = trim($_REQUEST['publisher']);$pubdate = trim($_REQUEST['pubdate']);$edition = trim($_REQUEST['edition']);$pages = trim($_REQUEST['pages']);$catname = trim($_REQUEST['CategoryName']);$firstname = trim($_REQUEST['strFName']);$lastname =trim( $_REQUEST['strLName']);////////////////////////////////////////////////////////////////$errors = array(); if (!preg_match ('/^[0-9]+{13}&/', $isbn)) {$errors[] = 'ISBN must be numeric and 13 characters long';} if (empty($_POST["title"])) {$errors[] = 'Title cannot be empty';} if (empty($_POST["description"])) {$errors[] = 'Description cannot be empty';} if (!preg_match ('/^$[0-9\.]&/', $price)) {$errors[] = 'Price must be in $USD';} if (empty($_POST["publisher"])) {$errors[] = 'Publisher cannot be empty';} if (!preg_match ('!^(0[1-9]|[12][0-9]|3[01])[- /.](0[1-9]|1[012])[- /.](19|20)\d\d!', $pubdate)) {$errors[] = 'Date must be in dd-mm-yyyy';} if (!preg_match ('/^[0-9]{2}$/', $edition)) {$errors[] = 'Edition must be numeric and 2 digits long';} if (!preg_match ('/^[0-9]$/', $pages)) {$errors[] = 'Pages must be numeric';} if (empty($_POST["catname"])) {$errors[] = 'Category cannot be empty';} if (empty($_POST["firstname"])) {$errors[] = 'First Name cannot be empty';} if (empty($_POST["lastname"])) {$errors[] = 'Last Name cannot be empty';} if (empty($errors)) { $sql_ba = "INSERT INTO bookauthors (strFName, strLName) values('$firstname', '$lastname');"; $sql_bd = "INSERT INTO bookdescriptions (ISBN, title, description, price, publisher, pubdate, edition, pages) values('$isbn', '$title', '$description', '$price', '$publisher', '$pubdate', '$edition', '$pages');"; $sql_bab = "INSERT INTO bookauthorsbooks (ISBN, AuthorID) values('$isbn', LAST_INSERT_ID());"; $sql_bc = "INSERT INTO bookcategories (CategoryName) values('$catname');"; $sql_bcb = "INSERT INTO bookcategoriesbooks (CategoryID, ISBN) VALUES(LAST_INSERT_ID(), '$isbn');"; $sql = $sql_ba . $sql_bd . $sql_bab . $sql_bc . $sql_bc; echo $sql; $success = ''; if(mysqli_multi_query($conn, $sql)) { do { $success+=mysqli_affected_rows($conn); } while (mysqli_more_results($conn) && mysqli_next_result($conn)); } if ($success == 5) { echo "All records have been successfully inserted"; } } else { echo '<h1>Error!</h1> <p style="color:red;">The following error(s) occurred:<br />'; foreach ($errors as $msg) { echo " - $msg<br />\n"; } echo '</p><p>Please try again.</p>'; }/////////////////////////////////////////////////////////////////} mysqli_close($conn);?><form action="insertbook.php" method="post"> <fieldset><legend>Enter your information in the form below:</legend> <div id="field"> <label for="ISBN">ISBN: </label> <input type="text" name="ISBN" value="<?php if (isset($isbn)) echo htmlentities($isbn);?>"/> </div> <div id="field"> <label for="title">Title: </label> <input type="text" name="title" value="<?php if (isset($title)) echo htmlentities($title);?>"/> </div> <div id="field"> <label for="description">Description: </label> <input type="text" name="description" value="<?php if (isset($description)) echo htmlentities($description);?>"/> </div> <div id="field"> <label for="price">Price: </label> <input type="text" name="price" value="<?php if (isset($price)) echo htmlentities($price);?>"/> </div> <div id="field"> <label for="publisher">Publisher: </label> <input type="text" name="publisher" value="<?php if (isset($publisher)) echo htmlentities($publisher);?>"/> </div> <div id="field"> <label for="pubdate">Publish Date: </label> <input type="text" name="pubdate" value="<?php if (isset($pubdate)) echo htmlentities($pubdate);?>"/> </div> <div id="field"> <label for="edition">Edition: </label> <input type="text" name="edition" value="<?php if (isset($edition)) echo htmlentities($edition);?>"/> </div> <div id="field"> <label for="pages">Pages: </label> <input type="text" name="pages" value="<?php if (isset($pages)) echo htmlentities($pages); ?>"/> </div> <div id="field"> <label for="CategoryName">Category Name: </label> <input type="text" name="CategoryName" value="<?php if (isset($CategoryName)) echo htmlentities($CategoryName);?>"/> </div> <div id="field"> <label for="strFName">Author First Name: </label> <input type="text" name="strFName" value="<?php if (isset($strFName)) echo htmlentities($strFName);?>"/> </div> <div id="field"> <label for="strLName">Author Last Name</label> <input type="text" name="strLName" value="<?php if (isset($strLName)) echo htmlentities($strLName);?>"/> </div> <br> <input id="submit" type="submit" value="Submit" name="submit"> </fieldset></form>

Here you find the average performance (time & memory) of each version. A grayed out version indicates it didn't complete successfully (based on exit-code).

VersionSystem time (s)User time (s)Memory (MiB)
8.3.40.0210.00018.40
8.3.30.0070.00719.04
8.3.20.0080.00020.16
8.3.10.0000.00820.54
8.3.00.0080.00019.25
8.2.170.0040.01122.96
8.2.160.0030.01020.39
8.2.150.0080.00024.18
8.2.140.0050.00324.66
8.2.130.0040.00426.16
8.2.120.0050.00322.09
8.2.110.0090.00020.53
8.2.100.0080.00418.09
8.2.90.0080.00019.17
8.2.80.0080.00017.97
8.2.70.0030.00517.50
8.2.60.0080.00017.80
8.2.50.0090.00318.07
8.2.40.0000.00818.09
8.2.30.0000.00818.01
8.2.20.0030.00617.58
8.2.10.0040.00417.96
8.2.00.0080.00017.68
8.1.270.0030.00622.05
8.1.260.0040.00426.35
8.1.250.0000.00728.09
8.1.240.0060.00322.14
8.1.230.0040.00719.20
8.1.220.0000.00817.74
8.1.210.0000.00818.77
8.1.200.0040.00417.23
8.1.190.0040.00416.98
8.1.180.0000.00918.10
8.1.170.0040.00418.51
8.1.160.0000.00721.89
8.1.150.0070.00018.71
8.1.140.0040.00417.35
8.1.130.0030.00317.85
8.1.120.0000.00717.36
8.1.110.0000.00817.26
8.1.100.0040.00417.25
8.1.90.0000.00717.36
8.1.80.0040.00417.31
8.1.70.0000.00717.27
8.1.60.0000.00817.45
8.1.50.0040.00417.31
8.1.40.0000.00717.39
8.1.30.0030.00617.37
8.1.20.0000.00817.52
8.1.10.0050.00317.49
8.1.00.0030.00517.46
8.0.300.0070.00018.77
8.0.290.0040.00416.63
8.0.280.0030.00318.28
8.0.270.0030.00317.26
8.0.260.0000.00617.23
8.0.250.0000.00816.74
8.0.240.0040.00416.83
8.0.230.0000.00716.85
8.0.220.0000.00616.70
8.0.210.0070.00016.73
8.0.200.0030.00316.80
8.0.190.0070.00316.76
8.0.180.0040.00416.86
8.0.170.0030.00616.86
8.0.160.0000.00716.68
8.0.150.0040.00416.64
8.0.140.0000.00716.73
8.0.130.0000.00513.19
8.0.120.0000.00816.76
8.0.110.0070.00016.72
8.0.100.0050.00316.75
8.0.90.0000.00716.66
8.0.80.0090.00616.79
8.0.70.0050.00216.65
8.0.60.0040.00416.77
8.0.50.0000.00716.78
8.0.30.0100.01217.12
8.0.20.0090.01017.40
8.0.10.0030.00616.74
8.0.00.0090.00816.75
7.4.330.0030.00315.00
7.4.320.0070.00016.41
7.4.300.0030.00316.37
7.4.290.0000.00816.49
7.4.280.0040.00416.54
7.4.270.0050.00216.41
7.4.260.0030.00316.29
7.4.250.0020.00516.45
7.4.240.0020.00516.44
7.4.230.0000.00716.29
7.4.220.0070.01316.53
7.4.210.0070.00716.37
7.4.200.0070.00016.48
7.4.160.0060.01116.25
7.4.150.0060.01417.40
7.4.140.0120.01017.86
7.4.130.0120.00516.42
7.4.120.0110.00616.32
7.4.110.0100.00616.26
7.4.100.0090.00916.41
7.4.90.0080.00816.21
7.4.80.0070.01119.39
7.4.70.0120.00816.38
7.4.60.0050.01116.20
7.4.50.0030.00516.36
7.4.40.0060.01016.44
7.4.30.0120.00916.58
7.4.00.0070.00714.76
7.3.330.0000.00613.07
7.3.320.0000.00613.00
7.3.310.0050.00216.02
7.3.300.0030.00316.20
7.3.290.0120.00316.17
7.3.280.0090.00716.17
7.3.270.0100.01317.40
7.3.260.0090.00916.29
7.3.250.0130.00416.23
7.3.240.0040.01216.44
7.3.230.0060.01616.45
7.3.210.0140.00416.26
7.3.200.0040.01219.39
7.3.190.0110.00616.33
7.3.180.0040.01216.60
7.3.170.0110.00516.34
7.3.160.0130.00616.20
7.2.330.0150.00316.28
7.2.320.0100.00716.33
7.2.310.0060.01616.72
7.2.300.0060.00916.60
7.2.290.0120.00616.61
7.2.00.0130.00019.46
7.1.100.0110.00718.03
7.1.70.0030.00316.94
7.1.60.0030.02119.32
7.1.50.0130.01016.81
7.1.00.0030.07722.51
7.0.200.0070.00316.77
7.0.140.0070.06322.09
7.0.60.0070.06719.97
7.0.50.0070.04017.82
7.0.40.0030.09020.04
7.0.30.0370.04320.02
7.0.20.0200.06020.12
7.0.10.0270.07720.13
7.0.00.0100.08720.32
5.6.280.0070.07020.91
5.6.210.0070.04320.47
5.6.200.0070.08718.18
5.6.190.0030.04320.60
5.6.180.0170.05320.35
5.6.170.0230.06020.47
5.6.160.0030.04720.48
5.6.150.0070.08018.13
5.6.140.0130.07318.14
5.6.130.0100.05018.12
5.6.120.0030.07021.06
5.6.110.0170.05021.14
5.6.100.0200.07721.01
5.6.90.0100.07721.11
5.6.80.0030.09320.39
5.6.70.3270.03020.38
5.5.350.0030.08320.43
5.5.340.0000.05717.91
5.5.330.0100.06020.40
5.5.320.0430.07320.20
5.5.310.0300.06320.18
5.5.300.0070.06717.91
5.5.290.0070.04017.91
5.5.280.0070.05020.99
5.5.270.0070.04320.80
5.5.260.0070.08020.87
5.5.250.0000.06320.60
5.5.240.0130.07320.27
5.4.450.0500.04719.46
5.4.440.0630.06719.32
5.4.430.0630.05719.46
5.4.420.0630.00019.29
5.4.410.0630.00019.25
5.4.400.0630.00019.16
5.4.390.0630.00018.94
5.4.380.0630.00019.00
5.4.370.0630.00019.15
5.4.360.0600.00019.05
5.4.350.0630.00019.06
5.4.340.0670.00019.18
5.4.320.0060.03612.47
5.4.310.0040.04012.46
5.4.300.0090.05212.47
5.4.290.0060.03712.46
5.4.280.0070.03412.36
5.4.270.0090.04412.36
5.4.260.0050.04612.36
5.4.250.0070.04012.36
5.4.240.0030.03912.36
5.4.230.0060.03812.36
5.4.220.0050.04112.36
5.4.210.0050.03712.35
5.4.200.0050.04212.36
5.4.190.0020.04012.35
5.4.180.0040.03812.36
5.4.170.0050.03712.36
5.4.160.0090.04812.36
5.4.150.0110.03312.36
5.4.140.0060.03812.04
5.4.130.0040.03712.03
5.4.120.0100.03711.98
5.4.110.0050.03811.98
5.4.100.0070.03411.98
5.4.90.0050.03811.98
5.4.80.0060.03611.98
5.4.70.0040.03711.98
5.4.60.0060.03511.98
5.4.50.0050.03611.98
5.4.40.0040.03711.96
5.4.30.0060.04011.96
5.4.20.0080.03511.96
5.4.10.0060.03411.97
5.4.00.0050.04311.45
5.3.290.0060.03912.80
5.3.280.0050.04112.70
5.3.270.0070.04612.73
5.3.260.0080.03912.72
5.3.250.0100.03612.72
5.3.240.0060.04012.72
5.3.230.0040.04112.71
5.3.220.0030.04412.68
5.3.210.0080.04612.68
5.3.200.0060.04212.68
5.3.190.0060.04112.68
5.3.180.0070.03512.67
5.3.170.0090.03412.67
5.3.160.0090.03812.68
5.3.150.0090.03612.67
5.3.140.0050.04012.66
5.3.130.0070.04812.66
5.3.120.0060.03812.66
5.3.110.0080.03812.66
5.3.100.0060.04512.12
5.3.90.0070.03712.08
5.3.80.0020.04312.07
5.3.70.0090.03912.08
5.3.60.0090.03812.07
5.3.50.0080.03412.00
5.3.40.0080.04112.00
5.3.30.0100.03211.96
5.3.20.0050.03811.74
5.3.10.0060.03611.70
5.3.00.0050.03611.70
5.2.170.0040.0319.20
5.2.160.0050.0299.20
5.2.150.0020.0329.20
5.2.140.0040.0319.20
5.2.130.0020.0329.16
5.2.120.0040.0349.15
5.2.110.0050.0289.16
5.2.100.0040.0339.16
5.2.90.0060.0359.16
5.2.80.0030.0349.16
5.2.70.0060.0349.16
5.2.60.0030.0319.11
5.2.50.0060.0299.08
5.2.40.0070.0269.06
5.2.30.0040.0309.03
5.2.20.0050.0289.02
5.2.10.0040.0338.94
5.2.00.0040.0298.80
5.1.60.0020.0268.09
5.1.50.0080.0268.08
5.1.40.0060.0258.06
5.1.30.0090.0268.41
5.1.20.0070.0278.43
5.1.10.0050.0268.16
5.1.00.0010.0288.16
5.0.50.0020.0236.64
5.0.40.0010.0296.50
5.0.30.0020.0366.31
5.0.20.0050.0196.28
5.0.10.0040.0196.26
5.0.00.0040.0306.25
4.4.90.0000.0184.78
4.4.80.0030.0154.75
4.4.70.0000.0184.76
4.4.60.0030.0164.75
4.4.50.0050.0154.77
4.4.40.0020.0274.71
4.4.30.0020.0164.76
4.4.20.0050.0134.85
4.4.10.0030.0154.85
4.4.00.0020.0274.76
4.3.110.0060.0124.67
4.3.100.0050.0124.67
4.3.90.0020.0154.63
4.3.80.0040.0234.58
4.3.70.0060.0214.63
4.3.60.0020.0164.63
4.3.50.0020.0164.63
4.3.40.0040.0244.54
4.3.30.0010.0173.31
4.3.20.0030.0153.28
4.3.10.0010.0173.25
4.3.00.0070.01016.59

preferences:
45.22 ms | 400 KiB | 5 Q