3v4l.org

run code in 300+ PHP versions simultaneously
<?php $countryCode = '+91'; $phoneNumber = '9028883545'; $callbackData = 'some text here'; $templateName = 'itk_auth_one_tap'; $languageCode = 'en'; $bodyValues = []; $otp = 'LIPSUM'; $headerValues = [$otp]; $buttonValues = [$otp]; // Using your exact code, notice that "buttonValues" doesn't match the expected output $data = [ "countryCode" => $countryCode, "phoneNumber" => $phoneNumber, "callbackData" => $callbackData, "type" => "Template", "template" => [ "name" => $templateName, "languageCode" => $languageCode, "bodyValues" => $bodyValues, "headerValues" => $headerValues, "buttonValues" => $buttonValues // This should be an OBJECT with a property named "0" ] ]; echo json_encode($data, JSON_PRETTY_PRINT); echo "\n\n"; // Let's try to fix it by forcing a stdClass $data = [ "countryCode" => $countryCode, "phoneNumber" => $phoneNumber, "callbackData" => $callbackData, "type" => "Template", "template" => [ "name" => $templateName, "languageCode" => $languageCode, "bodyValues" => $bodyValues, "headerValues" => $headerValues, "buttonValues" => (object) $buttonValues // Cast the array as stdClass ] ]; echo json_encode($data, 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.5.00.0130.00919.92
8.4.150.0020.00114.05
8.4.140.0130.00817.74
8.4.130.0150.00517.71
8.4.120.0080.01222.45
8.4.110.0120.00718.74
8.4.100.0060.00318.06
8.4.90.0120.00917.77
8.4.80.0030.00517.91
8.4.70.0130.00719.70
8.4.60.0090.01317.88
8.4.50.0100.00820.63
8.4.40.0130.00618.73
8.4.30.0070.00318.86
8.4.20.0040.00421.35
8.4.10.0060.00319.61
8.3.280.0110.01018.34
8.3.270.0100.00916.64
8.3.260.0110.00916.33
8.3.250.0100.00918.69
8.3.240.0090.01016.63
8.3.230.0100.01016.73
8.3.220.0100.00917.19
8.3.210.0120.00816.57
8.3.200.0080.01116.57
8.3.190.0110.00816.66
8.3.180.0130.00616.80
8.3.170.0030.00717.26
8.3.160.0100.00720.86
8.3.150.0100.01017.49
8.3.140.0040.00416.59
8.3.130.0160.00816.52
8.3.120.0030.00616.42
8.3.50.0030.00616.71
8.2.290.0100.00720.34
8.2.280.0100.00918.64
8.2.270.0110.00716.68
8.2.260.0070.00717.25
8.2.250.0040.00417.06
8.2.240.0030.00516.87
8.1.330.0110.00920.17
8.1.320.0100.00917.91
8.1.310.0030.00516.80
8.1.300.0030.00616.31

preferences:
67.26 ms | 403 KiB | 5 Q