3v4l.org

run code in 300+ PHP versions simultaneously
<?php $content = json_decode('{"creditor_trans_id":"655354-1","invoices":[{"id":"1111444","date_created":"2015-06-01T00:00:00","payment_due":"2015-06-22T00:00:00","currency":"PLN","total":"55555","left_to_pay":"9000"},{"id":"2222555","date_created":"2015-06-02T00:00:00","payment_due":"2015-06-23T00:00:00","currency":"PLN","total":"600","left_to_pay":"60"}],"attachments":[],"debtor_company":{"country":"PL","vat_id":"1112223334","name":"RST test12 15 52","email":"test1@truckx.eu","phone":"1234567","city":"Wroc\u0142aw","postal_code":"21-222","address":"chabrowa 4 kilka faktur bez plikow 1 waluta"}}', true); $data = [ 'transId' => $content['creditor_trans_id'], 'debtorCompany' => [ 'nip' => $content['debtor_company']['vat_id'], 'zipCode' => $content['debtor_company']['postal_code'], 'city' => $content['debtor_company']['city'], 'name' => $content['debtor_company']['name'], 'address' => $content['debtor_company']['address'], 'countryCode' => $content['debtor_company']['country'], 'email' => empty($content['debtor_company']['email']) ? null : $content['debtor_company']['email'], 'phone' => empty($content['debtor_company']['phone']) ? null : preg_replace('/[^0-9]/', '', $content['debtor_company']['phone']), ], 'invoices' => $content['invoices'], 'attachments' => $content['attachments'], ]; $content = $data; $content['debts'] = []; foreach ($content['invoices'] as $invoice) { $key = false; if ($content['debts']) { $key = array_search($invoice['currency'], array_column($content['debts'], 'currency')); } if ($key !== false) { $content['debts'][$key]['total'] = bcadd($content['debts'][$key]['total'], $invoice['total'], 2); $content['debts'][$key]['invoices'][] = $invoice; } else { $content['debts'][] = [ 'id' => 0, 'debtReportId' => 0, 'currency' => $invoice['currency'], 'total' => $invoice['total'], 'dateCreated' => null, 'invoices' => [ [ 'id' => 0, 'number' => $invoice['id'], 'issueDate' => $invoice['date_created'], 'paymentDate' => $invoice['payment_due'], 'total' => $invoice['total'], 'leftToPay' => $invoice['left_to_pay'], ] ], ]; } } unset($content['invoices']); echo json_encode($content);

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.40.0160.00319.24
8.3.30.0070.01419.27
8.3.20.0080.00020.38
8.3.10.0030.00523.57
8.3.00.0050.00319.09
8.2.170.0120.00319.29
8.2.160.0000.01422.96
8.2.150.0040.00424.18
8.2.140.0040.00424.66
8.2.130.0080.00026.16
8.2.120.0000.00819.51
8.2.110.0090.00022.27
8.2.100.0000.01118.03
8.2.90.0000.00819.21
8.2.80.0030.00519.34
8.2.70.0090.00017.88
8.2.60.0030.00618.05
8.2.50.0050.00318.07
8.2.40.0080.00018.34
8.2.30.0040.00419.43
8.2.20.0000.00817.93
8.2.10.0040.00419.86
8.2.00.0040.00419.89
8.1.270.0000.00820.45
8.1.260.0080.00026.35
8.1.250.0040.00428.09
8.1.240.0060.00322.06
8.1.230.0080.00319.19
8.1.220.0060.00317.78
8.1.210.0050.00318.77
8.1.200.0080.00017.73
8.1.190.0000.00817.51
8.1.180.0050.00319.02
8.1.170.0050.00318.74
8.1.160.0030.00518.87
8.1.150.0080.00018.87
8.1.140.0050.00317.70
8.1.130.0030.00317.89
8.1.120.0000.00717.67
8.1.110.0050.00317.61
8.1.100.0020.00517.56
8.1.90.0070.00017.62
8.1.80.0000.00817.70
8.1.70.0000.00717.51
8.1.60.0040.00417.81
8.1.50.0040.00417.59
8.1.40.0040.00417.59
8.1.30.0080.00017.77
8.1.20.0040.00417.80
8.1.10.0050.00217.54
8.1.00.0040.00417.70
8.0.300.0070.00018.77
8.0.290.0060.00317.18
8.0.280.0070.00018.51
8.0.270.0000.00717.33
8.0.260.0000.00616.95
8.0.250.0030.00317.03
8.0.240.0000.00817.11
8.0.230.0030.00617.05
8.0.220.0050.00217.09
8.0.210.0000.00717.09
8.0.200.0070.00317.03
8.0.190.0040.00417.05
8.0.180.0040.00417.09
8.0.170.0000.00817.06
8.0.160.0040.00417.09
8.0.150.0040.00417.07
8.0.140.0040.00416.98
8.0.130.0040.00413.50
8.0.120.0000.00816.99
8.0.110.0030.00517.08
8.0.100.0000.00716.96
8.0.90.0040.00416.86
8.0.80.0080.00817.04
8.0.70.0000.00716.96
8.0.60.0050.00217.00
8.0.50.0040.00417.14
8.0.30.0030.02017.22
8.0.20.0090.01317.51
8.0.10.0000.00717.09
8.0.00.0140.00716.95
7.4.330.0000.00515.03
7.4.320.0000.00616.75
7.4.300.0030.00316.91
7.4.290.0000.00716.76
7.4.280.0000.00816.64
7.4.270.0030.00316.71
7.4.260.0070.00016.76
7.4.250.0080.00016.82
7.4.240.0020.00516.74
7.4.230.0000.00716.73
7.4.220.0090.00916.71
7.4.210.0060.01316.94
7.4.200.0000.00716.73
7.4.160.0150.00616.80
7.4.150.0120.00617.40
7.4.140.0150.00517.86
7.4.130.0190.00816.71
7.4.120.0110.01116.87
7.4.110.0060.01416.82
7.4.100.0030.01716.78
7.4.90.0070.01016.72
7.4.80.0070.01119.39
7.4.70.0090.01416.75
7.4.60.0070.01016.71
7.4.50.0050.00316.83
7.4.40.0140.00316.70
7.4.30.0090.00916.77
7.4.10.0090.00615.36
7.4.00.0030.01215.16
7.3.330.0030.00313.32
7.3.320.0000.00513.41
7.3.310.0040.00416.39
7.3.300.0040.00416.37
7.3.290.0070.00616.54
7.3.280.0090.00916.52
7.3.270.0090.01717.40
7.3.260.0060.01116.53
7.3.240.0030.01316.63
7.3.230.0090.00916.52
7.3.210.0090.00916.71
7.3.200.0060.01016.83
7.3.190.0080.00816.58
7.3.180.0060.01016.88
7.3.170.0130.00316.56
7.3.160.0110.00516.89
7.3.130.0110.00614.98
7.3.120.0090.00615.28
7.3.110.0090.00615.16
7.3.100.0000.01315.00
7.3.90.0000.01315.30
7.3.80.0000.01014.76
7.3.70.0100.00715.12
7.3.60.0040.01214.96
7.3.50.0030.00614.93
7.3.40.0100.00714.79
7.3.30.0110.00015.14
7.3.20.0000.00916.75
7.3.10.0040.00716.85
7.3.00.0040.00416.93
7.2.330.0090.00917.02
7.2.320.0110.01116.89
7.2.310.0030.01316.88
7.2.300.0070.01017.04
7.2.290.0030.01817.05
7.2.260.0110.00415.01
7.2.250.0040.01215.41
7.2.240.0080.00815.13
7.2.230.0100.00015.21
7.2.220.0040.01115.04
7.2.210.0100.00015.15
7.2.200.0070.01315.10
7.2.190.0070.01015.11
7.2.180.0060.00815.00
7.2.170.0030.00715.39
7.2.160.0070.00715.14
7.2.150.0060.00917.15
7.2.140.0060.00916.98
7.2.130.0000.01017.20
7.2.120.0030.01017.31
7.2.110.0030.00817.02
7.2.100.0070.01117.12
7.2.90.0070.00417.01
7.2.80.0040.00717.24
7.2.70.0070.00717.02
7.2.60.0050.00717.09
7.2.50.0030.01217.15
7.2.40.0000.01217.05
7.2.30.0100.00617.22
7.2.20.0090.00917.34
7.2.10.0060.01517.07
7.2.00.0050.01018.44
7.1.330.0070.00415.75
7.1.320.0070.00716.00
7.1.310.0040.00416.16
7.1.300.0000.01015.93
7.1.290.0040.01116.08
7.1.280.0110.00715.94
7.1.270.0100.00315.93
7.1.260.0030.00516.18
7.1.250.0040.00415.77
7.1.240.0080.00616.04
7.1.230.0080.00815.84
7.1.220.0030.00616.00
7.1.210.0000.01215.91
7.1.200.0110.00415.96
7.1.190.0060.00615.89
7.1.180.0040.00815.70
7.1.170.0120.00315.96
7.1.160.0040.00816.14
7.1.150.0030.01015.95
7.1.140.0060.00916.09
7.1.130.0060.00615.80
7.1.120.0030.01015.94
7.1.110.0120.00316.02
7.1.100.0060.00917.28
7.1.90.0030.01216.00
7.1.80.0070.00716.11
7.1.70.0000.00916.76
7.1.60.0090.00617.65
7.1.50.0070.00916.57
7.1.40.0080.00516.00
7.1.30.0050.00515.75
7.1.20.0110.00315.79
7.1.10.0060.00616.00
7.1.00.0050.03919.16
7.0.330.0030.00715.71
7.0.320.0030.01015.64
7.0.310.0040.00715.57
7.0.300.0030.01015.51
7.0.290.0030.01515.83
7.0.280.0030.01215.62
7.0.270.0080.00815.69
7.0.260.0030.01015.46
7.0.250.0050.00515.70
7.0.240.0090.00615.47
7.0.230.0000.01315.67
7.0.220.0080.00415.59
7.0.210.0060.00315.61
7.0.200.0060.00715.29
7.0.190.0030.01015.55
7.0.180.0120.00315.68
7.0.170.0000.01215.66
7.0.160.0030.00915.67
7.0.150.0000.01215.50
7.0.140.0000.00815.57
7.0.130.0040.00815.44
7.0.120.0030.00615.74
7.0.110.0230.03517.83
7.0.100.0080.04417.73
7.0.90.0090.04617.79
7.0.80.0050.03317.87
7.0.70.0050.04417.72
7.0.60.0040.02317.71
7.0.50.0030.05018.05
7.0.40.0050.04516.84
7.0.30.0070.04716.99
7.0.20.0080.04016.89
7.0.10.0070.04316.86
7.0.00.0150.04017.00
5.6.400.0060.00614.48
5.6.390.0040.00414.59
5.6.380.0100.00314.35
5.6.370.0120.00414.59
5.6.360.0130.00314.32
5.6.350.0070.00714.38
5.6.340.0070.01014.86
5.6.330.0100.00014.67
5.6.320.0060.00914.65
5.6.310.0130.00014.89
5.6.300.0030.01014.16
5.6.290.0030.00614.69
5.6.280.0030.04117.93
5.6.270.0070.00714.68
5.6.260.0060.00314.51
5.6.250.0030.03917.59
5.6.240.0100.04317.62
5.6.230.0030.04317.63
5.6.220.0020.02717.54
5.6.210.0100.04017.53
5.6.200.0050.04017.83
5.6.190.0030.04817.81
5.6.180.0070.04217.89
5.6.170.0130.02817.67
5.6.160.0120.04117.65
5.6.150.0040.04617.86
5.6.140.0080.04517.77
5.6.130.0090.04017.69
5.6.120.0020.05017.78
5.6.110.0080.03217.63
5.6.100.0050.05017.91
5.6.90.0100.02717.87
5.6.80.0030.04617.50
5.6.70.0110.03817.38
5.6.60.0060.04617.46
5.6.50.0120.03717.34
5.6.40.0050.04217.63
5.6.30.0070.04217.46
5.6.20.0100.04217.41
5.6.10.0030.04417.46
5.6.00.0100.03717.28
5.5.380.0060.04117.45
5.5.370.0100.03717.64
5.5.360.0050.03917.68
5.5.350.0150.03717.68
5.5.340.0070.04417.80
5.5.330.0100.03717.78
5.5.320.0070.04517.79
5.5.310.0110.03817.69
5.5.300.0070.03917.84
5.5.290.0090.04517.60
5.5.280.0080.04417.57
5.5.270.0070.04417.73
5.5.260.0080.02617.73
5.5.250.0050.04417.60
5.5.240.0050.04017.26
5.5.230.0070.04017.41
5.5.220.0060.02517.39
5.5.210.0080.04017.18
5.5.200.0090.04317.29
5.5.190.0030.04517.42
5.5.180.0070.04117.45
5.5.170.0060.00614.22
5.5.160.0090.04017.38
5.5.150.0060.04417.14
5.5.140.0080.03317.39
5.5.130.0050.03917.15
5.5.120.0090.03217.33
5.5.110.0080.04317.40
5.5.100.0070.02717.38
5.5.90.0030.04517.15
5.5.80.0050.02317.42
5.5.70.0080.04217.26
5.5.60.0080.04117.25
5.5.50.0100.03817.36
5.5.40.0060.02517.28
5.5.30.0060.02717.35
5.5.20.0030.04117.24
5.5.10.0090.04017.15
5.5.00.0030.04417.20
5.4.450.0080.03815.85
5.4.440.0020.03215.82
5.4.430.0050.03315.88
5.4.420.0080.03915.85
5.4.410.0070.03815.77
5.4.400.0060.02315.80
5.4.390.0030.02915.82
5.4.380.0080.04015.69
5.4.370.0070.02315.82
5.4.360.0000.04715.72
5.4.350.0030.02515.81
5.4.340.0020.04215.65
5.4.330.0000.01312.36
5.4.320.0030.03615.70
5.4.310.0050.04215.80
5.4.300.0020.03415.68
5.4.290.0070.03215.68
5.4.280.0050.04215.63
5.4.270.0060.02815.77
5.4.260.0070.03815.69
5.4.250.0020.04015.69
5.4.240.0050.02315.74
5.4.230.0090.03715.71
5.4.220.0080.04015.76
5.4.210.0030.03815.67
5.4.200.0050.04315.71
5.4.190.0030.02215.65
5.4.180.0120.03315.72
5.4.170.0040.03315.66
5.4.160.0020.02715.63
5.4.150.0050.04115.79
5.4.140.0040.04114.35
5.4.130.0050.04114.41
5.4.120.0120.03514.29
5.4.110.0030.02514.32
5.4.100.0070.04014.38
5.4.90.0080.03614.37
5.4.80.0030.04014.35
5.4.70.0030.02014.31
5.4.60.0100.03614.36
5.4.50.0050.03014.38
5.4.40.0050.02014.33
5.4.30.0100.02114.43
5.4.20.0050.03514.26
5.4.10.0030.04114.37
5.4.00.0030.03713.99
5.3.290.0030.06314.56
5.3.280.0130.06714.67
5.3.270.0070.05014.51
5.3.260.0170.03314.62
5.3.250.0030.06014.61
5.3.240.0030.05314.50
5.3.230.0130.04014.61
5.3.220.0030.05714.45
5.3.210.0030.05714.35
5.3.200.0070.05014.46
5.3.190.0130.03714.57
5.3.180.0070.06014.43
5.3.170.0070.05014.47
5.3.160.0070.06314.41
5.3.150.0030.07014.45
5.3.140.0000.04014.43
5.3.130.0030.08314.48
5.3.120.0130.07014.57
5.3.110.0030.06014.64
5.3.100.0070.07314.14
5.3.90.0100.03013.99
5.3.80.0070.07713.93
5.3.70.0070.07013.85
5.3.60.0030.07313.95
5.3.50.0130.06313.87
5.3.40.0070.05313.80
5.3.30.0100.06713.84
5.3.20.0030.07013.57
5.3.10.0030.04713.54
5.3.00.0100.06013.48
5.2.170.0100.03711.09
5.2.160.0000.03311.21
5.2.150.0100.03011.07
5.2.140.0100.06311.09
5.2.130.0030.05311.00
5.2.120.0000.06311.03
5.2.110.0000.06711.17
5.2.100.0000.05010.99
5.2.90.0100.03011.05
5.2.80.0000.04011.25
5.2.70.0070.06011.04
5.2.60.0030.06010.97
5.2.50.0070.05010.92
5.2.40.0030.03310.94
5.2.30.0070.05010.91
5.2.20.0100.05710.89
5.2.10.0030.04310.79
5.2.00.0100.05310.71
5.1.60.0130.04010.07
5.1.50.0030.0409.88
5.1.40.0030.0609.91
5.1.30.0070.03010.48
5.1.20.0070.05310.43
5.1.10.0070.0509.98
5.1.00.0070.03010.14
5.0.50.0000.0478.56
5.0.40.0100.0308.48
5.0.30.0030.0338.19
5.0.20.0000.0438.17
5.0.10.0070.0308.14
5.0.00.0000.0578.13
4.4.90.0070.0307.99
4.4.80.0000.0277.99
4.4.70.0070.0337.99
4.4.60.0030.0337.99
4.4.50.0000.0377.99
4.4.40.0030.0337.99
4.4.30.0000.0407.99
4.4.20.0030.0337.99
4.4.10.0070.0307.99
4.4.00.0000.0507.99
4.3.110.0000.0377.99
4.3.100.0000.0307.99
4.3.90.0000.0307.99
4.3.80.0000.0537.99
4.3.70.0070.0307.99
4.3.60.0000.0307.99
4.3.50.0070.0307.99
4.3.40.0030.0537.99
4.3.30.0030.0307.99
4.3.20.0030.0377.99
4.3.10.0070.0307.99
4.3.00.0000.0277.99

preferences:
56.91 ms | 400 KiB | 5 Q