3v4l.org

run code in 300+ PHP versions simultaneously
<?php require_once('db.php'); require_once('response.php'); //require_once('connectDB'); //header('Access-Control-Allow-Methods: GET'); // function that redirects to another url function redirect($url, $statusCode = 404) { header('Location: ' . $url, true, $statusCode); die(); } //giving permission to access only for the specific IP if($_SERVER[REMOTE_ADDR]==='87.202.220.188') { //connection with the database include('connectDB.php'); // if it's not a post request, redirection to non-existent page if($_SERVER['REQUEST_METHOD'] !== 'POST') { redirect('http://paragon.gr/content/', false); } // check request's content type header is JSON if($_SERVER['CONTENT_TYPE'] !== 'application/json') { // set up response for unsuccessful request $response = new Response(); $response->setHttpStatusCode(400); $response->setSuccess(false); $response->addMessage("Content Type header not set to JSON"); $response->send(); exit; } // get POST request body as the POSTed data will be JSON format //$rawPostData = file_get_contents('php://input'); /* if(!$jsonData = json_decode($rawPostData)) { // set up response for unsuccessful request $response = new Response(); $response->setHttpStatusCode(400); $response->setSuccess(false); $response->addMessage("Request body is not valid JSON"); $response->send(); exit; } */ //triming name in case there are spaces in between $name = trim($jsonData->name); $test = $jsonData->test; // inserting the data in the database table // $query = $writeDB->prepare('UPDATE test_db (name, test) values (:name, :test) WHERE `test_db`.`id` = 12'); //UPDATE `test_db` SET `name` = 'ha!' WHERE `users`.`id` = 44 $query = $writeDB->prepare('UPDATE `test_db` SET `name` = `ha!` WHERE `users`.`id` = 44'); $query->bindParam(':name', $name, PDO::PARAM_STR); $query->bindParam(':test', $test, PDO::PARAM_STR); $query->execute(); $returnData = array(); // $returnData['user_id'] = $lastID; $returnData['name'] = $name; $returnData['test'] = $test; // .json format to show success when content is added to the database $response = new Response(); $response->setHttpStatusCode(201); $response->setSuccess(true); $response->addMessage("= created"); $response->setData($returnData); $response->send(); exit; // will put redirection link to send command to specific ip // to give and update on the location they are going to mine the data. } // redirection to non-existent page for the IPs without permission to access else{ redirect('http://paragon.gr/content/', false); } ?>

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.0100.01016.88
8.3.50.0170.00018.33
8.3.40.0030.01318.91
8.3.30.0110.00418.83
8.3.20.0040.00423.36
8.3.10.0000.00823.66
8.3.00.0080.00022.44
8.2.180.0100.01018.41
8.2.170.0000.01522.96
8.2.160.0110.00419.41
8.2.150.0000.00924.18
8.2.140.0030.00624.66
8.2.130.0040.00426.16
8.2.120.0040.00426.16
8.2.110.0060.00319.30
8.2.100.0090.00319.23
8.2.90.0060.00317.63
8.2.80.0040.00419.65
8.2.70.0000.00818.05
8.2.60.0090.00018.09
8.2.50.0040.00418.10
8.2.40.0090.00019.48
8.2.30.0050.00219.11
8.2.20.0070.00018.17
8.2.10.0040.00419.30
8.2.00.0040.00419.16
8.1.280.0070.01025.92
8.1.270.0060.00320.82
8.1.260.0070.00026.35
8.1.250.0040.00428.09
8.1.240.0050.00323.92
8.1.230.0040.00722.09
8.1.220.0040.00417.74
8.1.210.0030.00618.77
8.1.200.0030.00617.36
8.1.190.0040.00417.25
8.1.180.0080.00018.10
8.1.170.0000.00818.57
8.1.160.0000.00818.86
8.1.150.0080.00018.78
8.1.140.0000.00720.89
8.1.130.0070.00020.12
8.1.120.0070.00017.34
8.1.110.0030.00617.44
8.1.100.0040.00417.44
8.1.90.0000.00717.46
8.1.80.0040.00417.36
8.1.70.0000.00717.41
8.1.60.0000.00817.52
8.1.50.0080.00017.52
8.1.40.0040.00417.50
8.1.30.0030.00617.62
8.1.20.0000.00817.71
8.1.10.0040.00417.51
8.1.00.0000.00817.53
8.0.300.0040.00421.64
8.0.290.0000.00716.88
8.0.280.0000.00818.45
8.0.270.0030.00317.28
8.0.260.0070.00020.09
8.0.250.0040.00417.03
8.0.240.0040.00417.13
8.0.230.0000.00717.11
8.0.220.0040.00417.04
8.0.210.0000.00717.07
8.0.200.0030.00517.09
8.0.190.0030.00617.02
8.0.180.0040.00417.14
8.0.170.0000.00817.10
8.0.160.0020.00517.09
8.0.150.0000.00816.87
8.0.140.0000.00717.00
8.0.130.0000.00613.50
8.0.120.0000.00816.94
8.0.110.0070.00017.10
8.0.100.0040.00416.94
8.0.90.0030.00616.91
8.0.80.0090.00817.09
8.0.70.0080.00016.86
8.0.60.0000.00817.02
8.0.50.0000.00716.96
8.0.30.0110.00717.20
8.0.20.0150.00617.25
8.0.10.0000.00717.05
8.0.00.0120.00916.64
7.4.330.0050.00015.55
7.4.320.0030.00316.46
7.4.300.0030.00316.47
7.4.290.0050.00316.64
7.4.280.0030.00616.64
7.4.270.0030.00316.66
7.4.260.0030.00313.22
7.4.250.0000.00716.54
7.4.240.0020.00616.65
7.4.230.0040.00416.45
7.4.220.0030.00316.58
7.4.210.0060.01016.62
7.4.200.0030.00316.75
7.4.140.0110.00717.86
7.4.130.0120.00816.36
7.4.120.0210.00316.59
7.4.110.0150.00416.52
7.4.100.0150.00616.62
7.4.90.0100.00716.65
7.4.80.0130.00519.39
7.4.70.0070.01016.43
7.4.60.0060.01216.48
7.4.50.0000.01416.59
7.4.40.0130.01016.41
7.4.10.0070.01315.14
7.4.00.0110.00714.96
7.3.330.0000.00716.23
7.3.320.0030.00313.29
7.3.310.0000.00716.16
7.3.300.0030.00316.35
7.3.290.0050.01216.26
7.3.280.0120.00616.35
7.3.260.0110.01016.41
7.3.240.0090.00716.44
7.3.230.0040.01216.41
7.3.210.0070.01416.46
7.3.200.0120.00816.29
7.3.190.0030.01616.46
7.3.180.0100.01116.50
7.3.170.0080.01416.46
7.3.160.0060.00916.45
7.3.130.0040.01414.55
7.3.120.0050.01314.86
7.3.110.0120.00514.58
7.3.100.0070.00514.67
7.3.90.0090.00714.87
7.3.80.0080.00614.78
7.3.70.0060.00914.81
7.3.60.0110.00314.79
7.3.50.0100.00514.81
7.3.40.0040.01014.72
7.3.30.0080.00614.84
7.3.20.0150.00216.05
7.3.10.0100.00516.00
7.3.00.0080.00515.84
7.2.330.0130.00716.48
7.2.320.0040.01216.48
7.2.310.0040.01616.80
7.2.300.0130.00716.57
7.2.290.0040.01216.64
7.2.260.0100.01014.89
7.2.250.0160.00215.01
7.2.240.0050.01214.87
7.2.230.0020.01315.10
7.2.220.0060.00814.91
7.2.210.0040.00914.97
7.2.200.0060.00815.00
7.2.190.0090.00814.72
7.2.180.0030.01014.89
7.2.170.0060.00714.92
7.2.160.0040.01014.88
7.2.150.0090.00915.72
7.2.140.0090.00615.88
7.2.130.0090.00515.95
7.2.120.0090.00415.98
7.2.110.0110.00615.80
7.2.100.0090.00615.79
7.2.90.0090.00515.80
7.2.80.0040.01115.74
7.2.70.0030.01215.82
7.2.60.0060.00815.80
7.2.50.0100.00615.89
7.2.40.0070.00916.06
7.2.30.0060.01115.99
7.2.20.0060.01115.88
7.2.10.0040.00916.09
7.2.00.0060.00915.92
7.1.330.0050.00915.76
7.1.320.0060.00715.03
7.1.310.0070.00514.99
7.1.300.0080.00714.99
7.1.290.0050.00915.05
7.1.280.0070.00615.11
7.1.270.0050.00915.03
7.1.260.0090.00614.98
7.1.250.0050.00914.62
7.1.240.0090.00615.61
7.1.230.0100.01015.64
7.1.220.0070.01015.67
7.1.210.0100.01015.63
7.1.200.0000.01115.51
7.1.190.0000.00915.52
7.1.180.0130.00315.59
7.1.170.0030.01315.78
7.1.160.0070.01015.79
7.1.150.0090.00315.77
7.1.140.0050.00515.83
7.1.130.0110.00415.65
7.1.120.0000.01815.79
7.1.110.0040.01515.56
7.1.100.0090.00615.53
7.1.90.0140.00315.57
7.1.80.0070.00615.84
7.1.70.0090.00915.81
7.1.60.0060.00315.84
7.1.50.0040.00815.80
7.1.40.0000.00815.80
7.1.30.0060.00615.43
7.1.20.0030.00615.80
7.1.10.0030.01015.68
7.1.00.0030.00615.70

preferences:
61.08 ms | 400 KiB | 5 Q