3v4l.org

run code in 300+ PHP versions simultaneously
<?php // This is the automatic DB push code // This value is pulled from the HTTP server $spaces=" "; $yikes ="!!!!!!!!"; $IPAddress = $_SERVER['REMOTE_ADDR']; $dieClose = " </body> </html>\n"; if ( empty ( $_POST ) ) { die ( "No variables passed in on HTTP POST" . $dieClose );//GET variables have been set } //setup filters to prevent invalid data input and malicious code insertion $filters = array ( "eventid" => array ("filter"=>FILTER_VALIDATE_REGEXP, // STRING epoch date int followed by "_" followed by an IP address i.e.: "1384204604_172.16.198.48" "options"=>array("regexp"=>"/^([0-9]+)_(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})$/")), "oslist" => array ("filter"=>FILTER_VALIDATE_REGEXP, // STRING (alnum and "," only), CSV OS name list. i.e.: "win7x64,debianx64,dos" "options"=>array("regexp"=>"/^((([a-zA-Z0-9]+),)*)([a-zA-Z0-9_]+)$/")), "hostip" => array ("filter"=>FILTER_VALIDATE_IP), "state" => array ("filter"=>FILTER_VALIDATE_REGEXP, // STRING characters "s" and "e" ONLY!!! indicates "start" or "end" "options"=>array("regexp"=>"/^[se]$/")), "hddinfo" => array ("filter"=>FILTER_VALIDATE_REGEXP, // STRING (0-9 and "," only), CSV HDD size list in kB i.e. "12313,123123,1132" "options"=>array("regexp"=>"/^((\d+,)*)(\d+)$/")), "meminfo" => array ("filter"=>FILTER_SANITIZE_STRING), "cpuinfo" => array ("filter"=>FILTER_SANITIZE_STRING), "error" => array ("filter"=>FILTER_VALIDATE_INT, "options"=>array("min_range"=>0,"max_range"=>1024) ), ); $inputFields = filter_input_array(INPUT_POST, $filters); //var_dump($inputFields); //for debugging $DBfields=array("eventid", "oslist", "hostip", "state", "hddinfo", "meminfo", "cpuinfo", "error"); $Results =array(); //$keyvalue="eventid"; foreach ($DBfields as &$keyvalue) { if (!$inputFields[$keyvalue]) { die($yikes . $keyvalue . "=" . $_POST[$keyvalue] . " invalid" . $yikes . $dieClose); } else { //echo($spaces . "Got a valid " . $keyvalue . "=" . $inputFields[$keyvalue] . "\n" ); //for debugging $Results[$keyvalue] = $inputFields[$keyvalue]; } } $MyQuery = "INSERT INTO `clonestats`.`stattable` ( `eventid`, `oslist`, `hostip`, `state`, `hddinfo`, `meminfo`, `cpuinfo`, `error` ) " . "VALUES ( '" . $Results['eventid'] . "', '" . $Results['oslist'] . "', '" . $IPAddress . ", " . $Results['hostip'] . "','" . $Results['state'] . "', '" . $Results['hddinfo'] . "', '" . $Results['meminfo'] . "', '" . $Results['cpuinfo'] . "', '" . $Results['error'] . "' );"; //echo("my query is \n\t$MyQuery"); //for debugging only $NewDBConnection = mysql_connect ( "localhost", "CloneStatPush", "5a97114c932162a11622eb34cb2589586ffa70fb7ee85d267c8dc06ba3de2a9c" ); if (!$NewDBConnection) { die ( "\n".$yikes." I didn't successfully connect to the database" . $yikes . $dieClose ); // link to DB is bad } else { mysql_select_db ( "clonestats" ); // echo $MyQuery; mysql_query ( $MyQuery ); echo mysql_affected_rows ( ); // Prints the result of the INSERT command, client doesn't need to do anything with it mysql_close ( $DBlink ); } ?>

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.60.0140.00016.63
8.3.50.0140.00716.44
8.3.40.0070.01119.02
8.3.30.0110.00418.84
8.3.20.0050.00318.73
8.3.10.0050.00318.81
8.3.00.0070.00319.38
8.2.180.0070.00718.54
8.2.170.0060.00922.96
8.2.160.0090.00619.14
8.2.150.0030.00524.18
8.2.140.0080.00024.66
8.2.130.0050.00326.16
8.2.120.0030.00521.00
8.2.110.0050.00522.20
8.2.100.0040.00818.02
8.2.90.0050.00317.88
8.2.80.0050.00317.97
8.2.70.0060.00317.63
8.2.60.0060.00318.03
8.2.50.0050.00318.07
8.2.40.0040.00419.48
8.2.30.0040.00417.83
8.2.20.0060.00317.75
8.2.10.0040.00417.82
8.2.00.0050.00217.93
8.1.280.0140.00425.92
8.1.270.0000.00823.99
8.1.260.0040.00426.35
8.1.250.0080.00028.09
8.1.240.0040.00422.05
8.1.230.0110.00019.22
8.1.220.0030.00517.74
8.1.210.0050.00318.77
8.1.200.0030.00717.35
8.1.190.0060.00317.23
8.1.180.0000.00818.10
8.1.170.0080.00018.83
8.1.160.0040.00419.05
8.1.150.0040.00418.55
8.1.140.0040.00417.55
8.1.130.0070.00017.48
8.1.120.0000.00717.48
8.1.110.0040.00417.36
8.1.100.0040.00417.35
8.1.90.0000.00717.38
8.1.80.0000.00717.51
8.1.70.0000.00717.47
8.1.60.0090.00017.64
8.1.50.0040.00417.53
8.1.40.0040.00417.54
8.1.30.0000.00817.63
8.1.20.0020.00517.71
8.1.10.0000.00717.63
8.1.00.0040.00417.53
8.0.300.0000.00819.69
8.0.290.0000.00716.75
8.0.280.0000.00818.60
8.0.270.0030.00317.30
8.0.260.0050.00316.83
8.0.250.0060.00317.12
8.0.240.0030.00316.99
8.0.230.0050.00317.07
8.0.220.0030.00316.98
8.0.210.0040.00416.90
8.0.200.0070.00017.05
8.0.190.0040.00416.99
8.0.180.0050.00317.00
8.0.170.0050.00216.87
8.0.160.0030.00416.99
8.0.150.0080.00017.01
8.0.140.0040.00416.91
8.0.130.0030.00313.46
8.0.120.0040.00416.98
8.0.110.0040.00416.99
8.0.100.0070.00016.96
8.0.90.0000.01016.88
8.0.80.0060.00916.94
8.0.70.0000.00816.88
8.0.60.0000.00916.93
8.0.50.0040.00416.88
8.0.30.0110.00617.15
8.0.20.0100.01217.21
8.0.10.0000.00717.00
8.0.00.0070.01216.82
7.4.330.0060.00013.02
7.4.320.0030.00316.55
7.4.300.0030.00316.52
7.4.290.0000.00816.62
7.4.280.0040.00416.67
7.4.270.0050.00316.51
7.4.260.0050.00013.29
7.4.250.0000.00916.42
7.4.240.0070.00016.53
7.4.230.0070.00016.51
7.4.220.0140.00316.59
7.4.210.0060.00916.41
7.4.200.0050.00316.54
7.4.190.0000.00716.80
7.4.160.0080.00816.35
7.4.150.0110.00716.52
7.4.140.0160.00717.86
7.4.130.0120.00916.46
7.4.120.0040.01816.55
7.4.110.0110.00916.61
7.4.100.0080.00816.50
7.4.90.0150.00616.64
7.4.80.0070.01016.55
7.4.70.0060.01216.70
7.4.60.0090.00616.46
7.4.50.0000.00516.48
7.4.40.0140.00316.54
7.4.30.0080.00816.57
7.4.00.0100.00714.98
7.3.330.0070.00013.21
7.3.320.0030.00313.26
7.3.310.0000.00716.46
7.3.300.0000.00716.29
7.3.290.0110.00516.34
7.3.280.0160.00316.45
7.3.270.0100.01416.75
7.3.260.0110.00616.38
7.3.240.0060.01216.49
7.3.230.0110.00616.48
7.3.210.0060.01016.44
7.3.200.0110.00616.59
7.3.190.0150.00616.52
7.3.180.0160.00016.37
7.3.170.0160.00316.53
7.3.160.0030.01416.53
7.3.120.0060.01214.93
7.2.330.0040.01616.81
7.2.320.0130.00416.85
7.2.310.0100.01316.56
7.2.300.0000.01716.72
7.2.290.0170.00016.51
7.2.110.0110.01516.54
7.2.00.0000.01319.36
7.1.100.0750.00416.25
7.1.70.0040.00417.18
7.1.60.0030.00717.23
7.1.50.0030.01716.93
7.1.00.0000.04722.27
7.0.200.0000.01516.75
7.0.140.0030.07022.00
7.0.120.0000.07722.24
7.0.60.0100.08019.84
7.0.50.0070.04717.89
7.0.40.0130.07020.23
7.0.30.0600.06320.20
7.0.20.0300.06020.16
7.0.10.0270.05720.20
7.0.00.0070.05720.09
5.6.280.0000.07320.93
5.6.210.0100.05720.63
5.6.200.0100.03718.14
5.6.190.0070.08320.45
5.6.180.0400.03320.77
5.6.170.0230.04720.67
5.6.160.0070.07020.52
5.6.150.0070.06718.19
5.6.140.0130.07318.18
5.6.130.0100.07718.20
5.6.120.0000.04721.05
5.6.110.0170.06321.15
5.6.100.0000.09021.02
5.6.90.0170.06321.03
5.6.80.0130.07020.34
5.6.70.4500.04020.36
5.5.350.0200.04320.45
5.5.340.0030.03717.98
5.5.330.0070.05020.11
5.5.320.0370.07320.18
5.5.310.0300.03720.33
5.5.300.0000.07317.98
5.5.290.0030.04318.01
5.5.280.0030.09320.91
5.5.270.0070.07320.78
5.5.260.0070.03720.79
5.5.250.0130.07320.68
5.5.240.0030.08320.17
5.4.450.0230.04319.41
5.4.440.3600.04319.39
5.4.430.0200.04319.30
5.4.420.0100.05319.25
5.4.410.0200.06019.52
5.4.400.0130.04719.16
5.4.390.0130.04719.07
5.4.380.0200.05718.54
5.4.370.0070.04318.68
5.4.360.0100.04718.59
5.4.350.0070.04612.00
5.4.340.0080.04511.99
5.4.320.0040.04312.47
5.4.310.0020.04212.47
5.4.300.0070.04112.48
5.4.290.0090.03812.47
5.4.280.0080.03512.37
5.4.270.0070.04012.37
5.4.260.0080.03712.37
5.4.250.0080.04212.37
5.4.240.0090.04012.37
5.4.230.0080.03812.36
5.4.220.0070.04112.36
5.4.210.0090.04112.36
5.4.200.0090.04712.36
5.4.190.0100.06012.36
5.4.180.0070.04412.36
5.4.170.0060.04212.37
5.4.160.0070.04012.37
5.4.150.0070.04212.36
5.4.140.0060.04212.04
5.4.130.0080.03812.03
5.4.120.0080.03711.99
5.4.110.0070.03811.99
5.4.100.0070.03711.99
5.4.90.0070.03811.99
5.4.80.0080.04311.99
5.4.70.0080.03911.98
5.4.60.0050.04411.98
5.4.50.0080.04211.99
5.4.40.0070.03711.97
5.4.30.0070.03911.97
5.4.20.0070.03611.97
5.4.10.0070.03711.97
5.4.00.0080.04711.46
5.3.290.0040.04012.80
5.3.280.0070.04412.71
5.3.270.0070.05212.72
5.3.260.0090.04912.72
5.3.250.0080.04812.72
5.3.240.0060.04212.72
5.3.230.0070.03812.71
5.3.220.0090.03812.68
5.3.210.0090.03812.68
5.3.200.0080.04212.68
5.3.190.0040.04212.68
5.3.180.0060.04012.67
5.3.170.0090.04112.67
5.3.160.0070.04812.67
5.3.150.0070.04912.67
5.3.140.0070.04912.66
5.3.130.0070.04512.66
5.3.120.0070.04612.66
5.3.110.0080.04312.66
5.3.100.0050.03912.12
5.3.90.0070.03612.09
5.3.80.0090.04212.08
5.3.70.0070.04412.07
5.3.60.0090.04212.06

preferences:
43.04 ms | 401 KiB | 5 Q