3v4l.org

run code in 300+ PHP versions simultaneously
<?php // token used for webservice authentication define('AUTH_TOKEN', 'UvNdcV8tYZUQCDc2W8re7CvHckWzQcT5'); // define the webservice endpoint path define('WS_ENDPOINT', 'https://tina.talmatravel.co.il/html/demoTina3/tina/disp.php?module=RemoteData/EntityManagementWs&action=handleRequest'); /** * Execute JSON webservice request * @param array $operationParams * @param stdClass $request * @throws Exception * @return mixed */ function restJsonCall(array $operationParams, stdClass $request = null) { $endPoint = str_replace(" ", "%20", WS_ENDPOINT).'&'.http_build_query($operationParams); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $endPoint); curl_setopt($ch, CURLOPT_POST, 1); if ($request) { curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($request)); } curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); //curl_setopt($ch, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']); //curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); $response = curl_exec ($ch); if (curl_error($ch)) { throw new Exception('CURL eror: '.curl_errno($ch)); } $responseDecoded = json_decode($response); // invalid response if (!$responseDecoded) { throw new Exception('Invalid REST response: '.$response); } elseif ($responseDecoded->status!='ok') { throw new Exception('Error while executing operation: '. $responseDecoded->message); } return $responseDecoded; } // STEP 1: AUTHENTICATION // get the auth token first $operationParams_Authenticate = array('operation' => 'authenticate', 'authToken' => AUTH_TOKEN); $rq = new stdClass(); $rs = restJsonCall($operationParams_Authenticate, $rq); $token = $rs->sessionToken; // STEP 2: INSERT NEW SUPPLIER // initialize hit count; must be incremented on each request $hitCount = 0; // Prepare the request body $supplierInsertRequest = new stdClass(); $supplierInsertRequest->alias = 'COMPANY ALIAS'; $supplierInsertRequest->company = 'COMPANY NAME'; $supplierInsertRequest->email = 'companyname@noreply.com'; // assemble the operationParams array $operationParamsForSupplierInsert = array( 'sessionToken' => $token, 'hitCount' => ++$hitCount, 'entity' => 'supplier', 'operation' => 'insert', ); // call the operation $supplierInsertResponse = restJsonCall($operationParamsForSupplierInsert, $supplierInsertRequest); // display the response var_dump(json_encode($supplierInsertResponse, JSON_PRETTY_PRINT)); //get supplier id $idSupplier = $supplierInsertResponse->idEntity; // STEP 3: SELECT INSERTED SUPPLIER // for UPDATE / DELETE / SELECT, a valid ID must be specified // assemble the operationParams array: $operationParamsForSupplierSelect = array( 'sessionToken' => $token, 'hitCount' => ++$hitCount, 'entity' => 'supplier', 'operation' => 'select', 'id' => $idSupplier, ); // call the operation $supplierSelectResponse = restJsonCall($operationParamsForSupplierSelect); // display the response var_dump(json_encode($supplierSelectResponse, JSON_PRETTY_PRINT)); // STEP 4: DELETE INSERTED SUPPLIER // for UPDATE / DELETE / SELECT, a valid ID must be specified // assemble the operationParams array: $operationParamsForSupplierDelete = array( 'sessionToken' => $token, 'hitCount' => ++$hitCount, 'entity' => 'supplier', 'operation' => 'delete', 'id' => $idSupplier, ); // call the operation $supplierDeleteResponse = restJsonCall($operationParamsForSupplierDelete); // display the response var_dump(json_encode($supplierDeleteResponse, JSON_PRETTY_PRINT));

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.70.0080.00818.70
8.3.60.0090.00618.27
8.3.50.0100.01018.19
8.3.40.0030.01618.82
8.3.30.0110.00418.84
8.3.20.0080.00018.82
8.3.10.0040.00421.74
8.3.00.0030.00521.90
8.2.190.0120.00318.50
8.2.180.0150.00418.32
8.2.170.0040.01122.96
8.2.160.0100.00320.47
8.2.150.0000.00824.18
8.2.140.0030.00624.66
8.2.130.0050.00322.29
8.2.120.0070.00026.35
8.2.110.0040.00720.52
8.2.100.0080.00417.91
8.2.90.0060.00317.88
8.2.80.0080.00017.97
8.2.70.0060.00317.80
8.2.60.0000.00818.34
8.2.50.0090.00018.10
8.2.40.0040.00419.46
8.2.30.0000.00720.58
8.2.20.0040.00618.22
8.2.10.0000.00718.08
8.2.00.0030.00519.38
8.1.280.0090.00625.92
8.1.270.0040.00420.20
8.1.260.0080.00026.35
8.1.250.0050.00528.09
8.1.240.0060.00321.29
8.1.230.0080.00317.95
8.1.220.0000.00817.74
8.1.210.0040.00418.77
8.1.200.0090.00017.48
8.1.190.0030.00517.23
8.1.180.0040.00418.10
8.1.170.0000.00818.71
8.1.160.0090.00018.90
8.1.150.0070.00018.92
8.1.140.0000.00718.93
8.1.130.0080.00021.96
8.1.120.0000.00717.52
8.1.110.0040.00417.47
8.1.100.0000.00717.43
8.1.90.0050.00317.42
8.1.80.0110.00017.36
8.1.70.0070.00017.41
8.1.60.0040.00717.66
8.1.50.0070.00317.55
8.1.40.0000.00717.55
8.1.30.0000.00817.71
8.1.20.0040.00417.64
8.1.10.0030.00517.59
8.1.00.0030.00617.46
8.0.300.0040.00418.77
8.0.290.0040.00416.88
8.0.280.0070.00018.48
8.0.270.0030.00317.28
8.0.260.0060.00018.39
8.0.250.0080.00017.05
8.0.240.0040.00716.94
8.0.230.0040.00416.92
8.0.220.0070.00017.00
8.0.210.0040.00416.93
8.0.200.0000.00617.09
8.0.190.0040.00417.05
8.0.180.0000.00717.01
8.0.170.0030.00616.96
8.0.160.0030.00516.93
8.0.150.0000.00816.89
8.0.140.0040.00417.02
8.0.130.0030.00313.43
8.0.120.0030.00516.97
8.0.110.0020.00516.89
8.0.100.0040.00416.82
8.0.90.0030.00617.03
8.0.80.0020.01616.97
8.0.70.0000.00817.02
8.0.60.0000.00716.89
8.0.50.0040.00416.82
8.0.30.0090.00917.19
8.0.20.0080.01017.40
8.0.10.0040.00417.14
8.0.00.0100.01016.73
7.4.330.0020.00215.55
7.4.320.0070.00016.55
7.4.300.0080.00016.61
7.4.290.0000.00716.61
7.4.280.0060.00316.54
7.4.270.0040.00416.44
7.4.260.0030.00516.52
7.4.250.0050.00216.59
7.4.240.0000.00716.65
7.4.230.0040.00416.40
7.4.220.0040.00416.43
7.4.210.0100.00716.50
7.4.200.0040.00416.43
7.4.160.0120.00616.57
7.4.140.0100.00917.86
7.4.130.0100.00716.56
7.4.120.0110.01116.64
7.4.110.0140.00316.31
7.4.100.0090.01316.73
7.4.90.0160.01116.56
7.4.80.0100.01019.39
7.4.70.0140.00316.69
7.4.60.0160.00416.63
7.4.50.0100.00616.73
7.4.40.0100.01016.45
7.4.00.0080.00615.23
7.3.330.0020.00213.35
7.3.320.0050.00013.27
7.3.310.0030.00616.29
7.3.300.0070.00016.38
7.3.290.0000.00716.36
7.3.280.0060.01016.29
7.3.260.0150.00516.45
7.3.240.0060.01216.44
7.3.230.0070.01016.24
7.3.210.0090.00916.36
7.3.200.0060.00916.64
7.3.190.0100.01216.53
7.3.180.0090.00916.64
7.3.170.0190.00416.50
7.3.160.0120.00316.31
7.2.330.0060.01316.70
7.2.320.0060.01316.64
7.2.310.0070.01116.71
7.2.300.0110.00616.66
7.2.290.0120.00916.55
7.2.100.3510.00614.61
7.2.90.3370.01314.42
7.2.80.3070.01014.56
7.2.70.3390.01015.04
7.2.60.2940.00314.65
7.2.50.3220.00714.84
7.2.40.2740.00314.70
7.2.30.2470.01314.74
7.2.20.3250.01314.74
7.2.10.3160.01314.51
7.2.00.2980.01014.97
7.1.220.3280.01313.34
7.1.210.3420.00313.44
7.1.200.2840.01313.57
7.1.190.2610.00313.61
7.1.180.2490.00613.64
7.1.170.2760.00613.64
7.1.160.2720.00313.93
7.1.150.2910.01613.48
7.1.140.3710.01013.67
7.1.130.3540.01013.66
7.1.120.3500.00013.94
7.1.110.2850.00713.41
7.1.100.2570.00313.73
7.1.90.3230.01314.00
7.1.80.1720.00013.61
7.1.70.0770.01013.80
7.1.60.4310.01631.79
7.1.50.2680.01031.28
7.1.40.4660.00631.69
7.1.30.4580.01631.96
7.1.20.0380.01931.51
7.1.10.7870.00713.70
7.1.00.3710.00713.86
5.6.380.0070.01013.87

preferences:
29.4 ms | 401 KiB | 5 Q