3v4l.org

run code in 300+ PHP versions simultaneously
<?php $products = json_decode('[ { "title": "Product One", "categories": ["one", "two"] }, { "title": "Product Two", "categories": ["two", "three"] }, { "title": "Product Three", "categories": ["three", "four"] } ]'); $result = []; foreach ($products as $row) { if (in_array('two', $row->categories)) { $result[] = $row; } } echo json_encode($result, 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.4.120.0120.00720.71
8.4.110.0090.01118.94
8.4.100.0100.01017.72
8.4.90.0100.01118.81
8.4.80.0140.00617.79
8.4.70.0120.01117.55
8.4.60.0120.00818.70
8.4.50.0140.00717.68
8.4.40.0130.00717.80
8.4.30.0040.01518.95
8.4.20.0130.00721.62
8.4.10.0030.00619.36
8.3.250.0100.00818.84
8.3.240.0070.00316.46
8.3.230.0140.00516.58
8.3.220.0100.00817.17
8.3.210.0140.00516.77
8.3.200.0060.00416.57
8.3.190.0170.00617.29
8.3.180.0130.00216.64
8.3.170.0110.00718.86
8.3.160.0000.00716.98
8.3.150.0090.00917.05
8.3.140.0150.00416.63
8.3.130.0000.00918.25
8.3.120.0060.01318.76
8.3.110.0070.00420.94
8.3.100.0100.01018.34
8.3.90.0080.00026.77
8.3.80.0040.00417.97
8.3.70.0260.00417.97
8.3.60.0270.00617.97
8.3.50.0040.00718.59
8.3.40.0210.00017.97
8.3.30.0160.00517.97
8.3.20.0220.00417.97
8.3.10.0250.00417.97
8.3.00.0210.00717.97
8.2.290.0100.00820.48
8.2.280.0040.00418.25
8.2.270.0070.00717.17
8.2.260.0110.00718.08
8.2.250.0070.01316.70
8.2.240.0070.01120.41
8.2.230.0060.00322.58
8.2.220.0000.00824.06
8.2.210.0000.01026.77
8.2.200.0060.00316.63
8.2.190.0230.00417.97
8.2.180.0210.00417.97
8.2.170.0200.00817.97
8.2.160.0250.00417.97
8.2.150.0310.00417.97
8.2.140.0230.01517.97
8.2.130.0240.00517.97
8.2.120.0160.01217.97
8.2.110.0190.00617.97
8.2.100.0130.00917.97
8.2.90.0200.00317.97
8.2.80.0210.01017.97
8.2.70.0220.00017.97
8.2.60.0130.01317.97
8.2.50.0230.00317.97
8.2.40.0280.00017.97
8.2.30.0120.00817.97
8.2.20.0170.00317.97
8.2.10.0160.00417.97
8.2.00.0080.01317.97
8.1.330.0110.00720.27
8.1.320.0120.00716.25
8.1.310.0080.00018.57
8.1.300.0110.00719.71
8.1.290.0030.00730.84
8.1.280.0210.00417.97
8.1.270.0170.00717.97
8.1.260.0230.00017.97
8.1.250.0180.00517.97
8.1.240.0220.00417.97
8.1.230.0210.00317.97
8.1.220.0160.00517.97
8.1.210.0150.00617.97
8.1.200.0220.00017.97
8.1.190.0130.01017.97
8.1.180.0180.00617.97
8.1.170.0200.00317.97
8.1.160.0150.00617.97
8.1.150.0160.00517.97
8.1.140.0170.00717.97
8.1.130.0150.00517.97
8.1.120.0120.00817.97
8.1.110.0190.00517.97
8.1.100.0150.00917.97
8.1.90.0120.01217.97
8.1.80.0240.00317.97
8.1.70.0200.00617.97
8.1.60.0270.00017.97
8.1.50.0210.00517.97
8.1.40.0200.00317.97
8.1.30.0170.00917.97
8.1.20.0270.00017.97
8.1.10.0190.00617.97
8.1.00.0220.00417.97

preferences:
48.45 ms | 403 KiB | 5 Q