3v4l.org

run code in 300+ PHP versions simultaneously
<?php $nameErr= $surnameErr= $emailErr= $address1Err= $address2Err= $postErr= $countyErr= $usernameErr= $passErr=""; if (isset($_POST['person'])) { include 'db.php'; $customer_name=addslashes($_POST['customer_name']) ; $customer_surname=addslashes($_POST['customer_surname']); $customer_email=addslashes($_POST['customer_email']) ; $address_line_1=addslashes($_POST['address_line_1']); $address_line_2=addslashes($_POST['address_line_2']) ; $customer_post=addslashes($_POST['customer_post']) ; $customer_county=addslashes($_POST['customer_county']) ; $customer_username=addslashes($_POST['customer_username']) ; $customer_password=addslashes($_POST['customer_password']) ; if ($_SERVER["REQUEST_METHOD"] == "POST") if(empty($customer_name)){ $nameErr= "Please provide the customers name.";} if(empty($customer_surname)){ $surnameErr= "Please provide the customers surname.";} if (!preg_match("/([\w\-]+\@[\w\-]+\.[\w\-]+)/",$customer_email)){ $emailErr = "Please provide a valid Email address."; } $customer_email = strtolower(trim($_POST["customer_email"])); $customer_email = filter_var($customer_email, FILTER_SANITIZE_STRING, FILTER_FLAG_STRIP_LOW|FILTER_FLAG_STRIP_HIGH); $results = mysql_query("SELECT customer_id FROM customers WHERE customer_email='$customer_email'"); $email_exist = mysql_num_rows($results); if($email_exist) { $emailErr="That email is already is use.";} if(empty($address_line_1)){ $address1Err= "Please provide a valid address.";} if(!preg_match_all("/^([a-zA-Z]){1}([0-9][0-9]|[0-9]|[a-zA-Z][0-9][a-zA-Z]|[a-zA-Z][0-9][0-9]|[a-zA-Z][0-9]){1}([ ])([0-9][a-zA-z][a-zA-z]){1}$/", $customer_post)) {$postErr="please provide a valid postcode.";} if(isset($_REQUEST['customer_county']) && $_REQUEST['customer_county'] == '0') { $countyErr = "Please pick the county in which you inhabit.";} if(empty($customer_username)){ $usernameErr= "please provide a valid username.";} if(isset($_POST["customer_username"])) { $customer_username = strtolower(trim($_POST["customer_username"])); $customer_username = filter_var($customer_username, FILTER_SANITIZE_STRING, FILTER_FLAG_STRIP_LOW|FILTER_FLAG_STRIP_HIGH); $results = mysql_query("SELECT customer_id FROM customers WHERE customer_username='$customer_username'"); $username_exist = mysql_num_rows($results); if($username_exist) { $usernameErr="That name is unavailable.";}} if (!preg_match_all('$\S*(?=\S{6,})(?=\S*[a-z])(?=\S*[A-Z])(?=\S*[\d])\S*$', $customer_password)) { $passErr="Please provide a valid password."; } if($nameErr=="" and $surnameErr=="" and $emailErr=="" and $address1Err=="" and $postErr=="" and $countyErr=="" and $usernameErr=="" and $passErr==""){ mysql_query("INSERT INTO `customers`(customer_name,customer_surname,customer_email,address_line_1,address_line_2,customer_post,customer_county,customer_username,customer_password) VALUES ('$customer_name','$customer_surname','$customer_email','$address_line_1','$address_line_2','$customer_post','$customer_county','$customer_username',md5('$customer_password')")"); }} ?> <!DOCTYPE HTML> <html> <head> <meta content="text/javascript"/> <link rel="stylesheet" type="text/css" href="css/blitzer/backsty.css"> <script type="text/javascript"> window.onload=function(){ var tfrow = document.getElementById('tfhover').rows.length; var tbRow=[]; for (var i=1;i<tfrow;i++) { tbRow[i]=document.getElementById('tfhover').rows[i]; tbRow[i].onmouseover = function(){ this.style.backgroundColor = '#F6D4D4'; }; tbRow[i].onmouseout = function() { this.style.backgroundColor = '#EB8686'; }; } }; </script> <script type="text/javascript"> function confirm_click(customer_name) { return confirm("Are you sure you want to delete "+ customer_name +" from the database ?"); } function validateEmail() { var emailID = document.userForm.customer_email.value; atpos = emailID.indexOf("@"); dotpos = emailID.lastIndexOf("."); if (atpos < 1 || ( dotpos - atpos < 2 )) { alert("Please provide correct email ID") document.userForm.customer_email.focus() ; return false; } return( true ); } function validatePost() { var postID = document.userForm.customer_post.value; regPostcode = /^([a-zA-Z]){1}([0-9][0-9]|[0-9]|[a-zA-Z][0-9][a-zA-Z]|[a-zA-Z][0-9][0-9]|[a-zA-Z][0-9]){1}([ ])([0-9][a-zA-z][a-zA-z]){1}$/; if(regPostcode.test(postID) == false) { alert("Please provide the correct Postcode"); document.userForm.customer_post.focus() ; return false; } return ( true ) ; } function validate() { if( document.userForm.customer_name.value == "" ) { alert("Please provide the customer name!"); document.userForm.customer_name.focus() ; return false; } if( document.userForm.customer_surname.value == "" ) { alert( "Please provide the customer surname!" ); document.userForm.customer_surname.focus() ; return false; } if( document.userForm.customer_email.value == "" ) { alert( "Please provide the correct Email!" ); document.userForm.customer_email.focus() ; return false; }else{ var ret = validateEmail(); if( ret == false ) { return false; } } if( document.userForm.address_line_1.value == "") { alert( "Please provide the correct address" ); document.userForm.address_line_1.focus() ; return false; } if( document.userForm.customer_post.value == "" ) { alert( "Please provide the correct postcode!" ); document.userForm.customer_post.focus() ; return false; }else{ var ret = validatePost(); if( ret == false ) { return false; } } if( document.userForm.customer_county.value == "0" ) { alert( "Please provide your county!" ); document.userForm.customer_username.focus() ; return false; } if( document.userForm.customer_username.value == "" ) { alert( "Please provide a valid Username!" ); document.userForm.customer_username.focus() ; return false; } var passw = /^(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{6,20}$/; if(document.userForm.customer_password.value.match(passw)) { return true; } else { alert('Please provide a valid password which contains 6 to 20 characters which contain at least one numeric digit, one uppercase and one lowercase letter.') return false; } } </script> </head> <body> <form method="LINK" ACTION="index_mod.php"> <input type="submit" class="button2" value="Admin Home" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>"> <h1>Customer Management</h1> </form> <div id="content"> <table> <form onsubmit="return(validate());" name="userForm" method="post" autocomplete="off"> <tr> <td>Name</td> <td><input type="text" class="textbox" name="customer_name" /></td><td> <span class="error"> <?php echo $nameErr ?></span> </td> </tr><tr> <td>Surname</td> <td><input type="text" class="textbox" name="customer_surname" /></td><td> <span class="error"> <?php echo $surnameErr ?></span> </td> </tr><tr> <td>Email</td> <td><input type="text" class="textbox" name="customer_email" /></td><td> <span class="error"> <?php echo $emailErr ?></span> </td> </tr><tr> <td>Address1</td> <td><input type="text" class="textbox" name="address_line_1" /></td><td> <span class="error"> <?php echo $address1Err ?></span> </td> </tr><tr> <td>Address2</td> <td><input type="text" class="textbox" name="address_line_2" /></td> </tr><tr> <td>Post code</td> <td><input type="text" class="textbox" name="customer_post" /></td><td> <span class="error"> <?php echo $postErr ?></span> </td> </tr><tr> <td>County<td> <select class="textbox" name="customer_county"> <option value="0">Please select</option> <option>Aberdeenshire</option> <option>Anglesey</option> <option>Angus (Forfarshire)</option> <option>Antrim</option> <option>Argyll</option> <option>Armagh</option> <option>Avon</option> <option>Ayrshire</option> <option>Banffshire</option> <option>Bedfordshire</option> <option>Berkshire</option> <option>Berwickshire</option> <option>Brecknockshire</option> <option>Buckinghamshire</option> <option>Bute</option> <option>Caernarfonshire</option> <option>Caithness</option> <option>Cambridgeshire and Isle of Ely</option> <option>Cambridgeshire</option> <option>Cardiganshire</option> <option>Carmarthenshire</option> <option>Cheshire</option> <option>City of Aberdeen</option> <option>City of Belfast</option> <option>City of Bristol</option> <option>City of Dundee</option> <option>City of Edinburgh</option> <option>City of Glasgow</option> <option>City of London</option> <option>City of Londonderry</option> <option>Clackmannanshire</option> <option>Cleveland</option> <option>Clwyd</option> <option>Cornwall</option> <option>County</option> <option>Cromartyshire</option> <option>Cumberland</option> <option>Cumbria</option> <option>Denbighshire</option> <option>Derbyshire</option> <option>Devon</option> <option>Dorset</option> <option>Down</option> <option>Dumfriesshire</option> <option>Dunbartonshire (Dumbarton)</option> <option>Durham</option> <option>Dyfed</option> <option>East Lothian (Haddingtonshire)</option> <option>East Suffolk</option> <option>East Sussex</option> <option>Essex</option> <option>Fermanagh</option> <option>Fife</option> <option>Flintshire</option> <option>Glamorgan</option> <option>Gloucestershire</option> <option>Greater London</option> <option>Greater Manchester</option> <option>Gwent</option> <option>Gwynedd</option> <option>Hampshire (County of Southampton)</option> <option>Hereford and Worcester</option> <option>Herefordshire</option> <option>Hertfordshire</option> <option>Humberside</option> <option>Huntingdon and Peterborough</option> <option>Huntingdonshire</option> <option>Inverness-shire</option> <option>Isle of Ely</option> <option>Isle of Wight</option> <option>Kent</option> <option>Kincardineshire</option> <option>Kinross-shire</option> <option>Kirkcudbrightshire</option> <option>Lanarkshire</option> <option>Lancashire</option> <option>Leicestershire</option> <option>Lincolnshire, Parts of Holland</option> <option>Lincolnshire, Parts of Kesteven</option> <option>Lincolnshire, Parts of Lindsey</option> <option>Lincolnshire</option> <option>London</option> <option>Londonderry</option> <option>Merionethshire</option> <option>Merseyside</option> <option>Mid Glamorgan</option> <option>Middlesex</option> <option>Midlothian (County of Edinburgh)</option> <option>Monmouthshire</option> <option>Montgomeryshire</option> <option>Moray (Elginshire)</option> <option>Nairnshire</option> <option>Norfolk</option> <option>North Humberside</option> <option>North Yorkshire</option> <option>Northamptonshire</option> <option>Northumberland</option> <option>Nottinghamshire</option> <option>Orkney</option> <option>Oxfordshire</option> <option>Peeblesshire</option> <option>Pembrokeshire</option> <option>Perthshire</option> <option>Powys</option> <option>Radnorshire</option> <option>Renfrewshire</option> <option>Ross and Cromarty</option> <option>Ross-shire</option> <option>Roxburghshire</option> <option>Rutland</option> <option>Selkirkshire</option> <option>Shetland (Zetland)</option> <option>Shropshire (Salop)</option> <option>Soke of Peterborough</option> <option>Somerset</option> <option>South Glamorgan</option> <option>South Humberside</option> <option>South Yorkshire</option> <option>Staffordshire</option> <option>Stirlingshire</option> <option>Suffolk</option> <option>Surrey</option> <option>Sussex</option> <option>Sutherland</option> <option>Tyne and Wear</option> <option>Tyrone</option> <option>Warwickshire</option> <option>West Glamorgan</option> <option>West Lothian (Linlithgowshire)</option> <option>West Midlands</option> <option>West Suffolk</option> <option>West Sussex</option> <option>West Yorkshire</option> <option>Westmorland</option> <option>Wigtownshire</option> <option>Wiltshire</option> <option>Worcestershire</option> <option>Yorkshire, East Riding</option> <option>Yorkshire, North Riding</option> <option>Yorkshire, West Riding</option> <option>Yorkshire</option> </select><td> <span class="error"> <?php echo $countyErr ?></span> </td> </tr><tr> <td>Username</td> <td><input class="textbox" type="text" name="customer_username" id="customer_username" /><span id="user-result"></span></td><td><span class="error"> <?php echo $usernameErr ?></span> </td> </tr><tr> <td>Password</td> <td><input class="textbox" type="text" name="customer_password" /></td><td> <span class="error"> <?php echo $passErr ?></span> </td> </tr><tr> <td>&nbsp;</td> <td><input type="submit" name="person" class="button1" /></td> </tr></form> </table> </div> <script type="text/javascript" src="js/jquery-1.9.0.min.js"></script> <script type="text/javascript"> $(document).ready(function() { $("#customer_username").keyup(function (e) { //removes spaces from username $(this).val($(this).val().replace(/\s/g, '')) var customer_username = $(this).val(); if(customer_username.length < 4){$("#user-result").html('');return;} if(customer_username.length >= 4){ $("#user-result").html('<img src="imgs/ajax-loader.gif" />'); $.post('check_username.php', {'customer_username':customer_username}, function(data) { $("#user-result").html(data); }); } }); }); </script> </form> <div id="stock"> <?php include("db.php"); $result=mysql_query("SELECT * FROM customers"); echo "<table id='tfhover'class='tftable' border='1'>\n"; echo "<tr>\n"; echo "<th>ID</th>\n"; echo "<th>Name</th>\n"; echo "<th>Surname</th>\n"; echo "<th>Email</th>\n"; echo "<th>Adress1</th>\n"; echo "<th>Adress2</th>\n"; echo "<th>Post code</th>\n"; echo "<th>County</th>\n"; echo "<th>Username</th>\n"; echo"<tr>\n"; while($test = mysql_fetch_array($result)){$id = $test['customer_id']; echo"<tr align='left'>\n"; echo"<td><font color='black'>" .$test['customer_id']. "</font></td>\n"; echo"<td><font color='black'>" .$test['customer_name']. "</font></td>\n"; echo"<td><font color='black'>". $test['customer_surname']. "</font></td>\n"; echo"<td><font color='black'>". $test['customer_email']. "</font></td>\n"; echo"<td><font color='black'>". $test['address_line_1']. "</font></td>\n"; echo"<td><font color='black'>". $test['address_line_2']. "</font></td>\n"; echo"<td><font color='black'>". $test['customer_post']. "</font></td>\n"; echo"<td><font color='black'>". $test['customer_county']. "</font></td>\n"; echo"<td><font color='black'>". $test['customer_username']."</font></td>\n"; echo"<td class='link'><a class='links' href ='custdata1.php?customer_id=$id'>Edit</a></td>\n"; echo"<td class=\"link\"><a onclick=\"return confirm_click('".$test['customer_name']."');\" class='links1' href='delcustdata.php?customer_id=$id'>Delete</a></td>\n"; echo "</tr>";} echo"</table>"; mysql_close($conn);?> </div> </body> </html>

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)
5.4.270.0060.04712.42
5.4.260.0170.04719.01
5.4.250.0130.05018.77
5.4.240.0200.04718.65
5.4.230.0030.05718.91
5.4.220.0100.05018.91
5.4.210.0100.06018.65
5.4.200.0100.06718.95
5.4.190.0070.05718.76
5.4.180.0030.05318.96
5.4.170.0070.06318.90
5.4.160.0070.06019.08
5.4.150.0130.06318.89
5.4.140.0170.05716.36
5.4.130.0070.07016.59
5.4.120.0130.05016.50
5.4.110.0130.04716.42
5.4.100.0130.04716.47
5.4.90.0100.05316.50
5.4.80.0200.05316.48
5.4.70.0100.04316.40
5.4.60.0070.05016.37
5.4.50.0100.07316.39
5.4.40.0130.06016.58
5.4.30.0130.06016.49
5.4.20.0130.05716.56
5.4.10.0130.05316.34
5.4.00.0200.04315.78
5.3.280.0070.05014.62
5.3.270.0000.08314.53
5.3.260.0030.05714.65
5.3.250.0070.06314.70
5.3.240.0100.04714.34
5.3.230.0070.05014.55
5.3.220.0130.05314.70
5.3.210.0030.05714.48
5.3.200.0130.05014.45
5.3.190.0100.05014.38
5.3.180.0070.05014.61
5.3.170.0170.05014.37
5.3.160.0200.06014.64
5.3.150.0070.06014.61
5.3.140.0100.07714.43
5.3.130.0100.04714.35
5.3.120.0100.07314.60
5.3.110.0100.06714.42
5.3.100.0030.07314.06
5.3.90.0100.04714.05
5.3.80.0100.06314.07
5.3.70.0130.04313.75
5.3.60.0170.04014.05
5.3.50.0070.07014.00
5.3.40.0130.06314.07
5.3.30.0030.05013.99
5.3.20.0030.05013.64
5.3.10.0070.06013.65
5.3.00.0070.05013.68
5.2.170.0000.04711.07
5.2.160.0070.04011.28
5.2.150.0130.03311.18
5.2.140.0000.04710.94
5.2.130.0000.04711.08
5.2.120.0100.03711.14
5.2.110.0070.05011.16
5.2.100.0070.03711.14
5.2.90.0130.03011.05
5.2.80.0070.04011.13
5.2.70.0070.04311.14
5.2.60.0000.05710.97
5.2.50.0100.03711.06
5.2.40.0100.05010.79
5.2.30.0070.04011.16
5.2.20.0070.04711.17
5.2.10.0100.03711.14
5.2.00.0030.04310.95
5.1.60.0030.03310.00
5.1.50.0030.04010.10
5.1.40.0170.03710.14
5.1.30.0070.04710.48
5.1.20.0100.05010.27
5.1.10.0070.0339.91
5.1.00.0070.03310.10
5.0.50.0070.0278.68
5.0.40.0030.0308.54
5.0.30.0070.0378.33
5.0.20.0030.0278.23
5.0.10.0070.0238.18
5.0.00.0030.0438.42
4.4.90.0030.0237.79
4.4.80.0000.0237.71
4.4.70.0070.0177.57
4.4.60.0070.0277.57
4.4.50.0000.0237.50
4.4.40.0100.0407.41
4.4.30.0070.0207.41
4.4.20.0070.0177.41
4.4.10.0100.0177.41
4.4.00.0100.0277.41
4.3.110.0030.0207.41
4.3.100.0030.0207.41
4.3.90.0030.0277.41
4.3.80.0070.0407.41
4.3.70.0100.0177.41
4.3.60.0030.0277.41
4.3.50.0030.0207.41
4.3.40.0000.0377.41
4.3.30.0070.0277.41
4.3.20.0070.0177.41
4.3.10.0000.0237.41
4.3.00.0170.02713.33

preferences:
147.02 ms | 941 KiB | 8 Q