3v4l.org

run code in 300+ PHP versions simultaneously
<?php $agents = [ (object)["id"=> 301,"name"=> "Agent 1"], (object)["id"=> 303,"name"=> "Agent 2"], (object)["id"=> 301,"name"=> "Agent 3"], (object)["id"=> 305,"name"=> "Agent 4"], (object)["id"=> 306,"name"=> "Agent 5"], (object)["id"=> 303,"name"=> "Agent 6"] ]; $locations = [ (object)["xid"=> 148,"location_name"=> "USA"], (object)["xid"=> 149,"location_name"=> "CHINA"], (object)["xid"=> 153,"location_name"=> "GERMANY"], (object)["xid"=> 156,"location_name"=> "CANADA"], (object)["xid"=> 167,"location_name"=> "SINGAPORE"], (object)["xid"=> 0,"location_name"=> "No Location"] ]; $records = [ (object)["agent_id"=> 301,"location_id"=> 156,"total"=> 10000], (object)["agent_id"=> 303,"location_id"=> 149,"total"=> 13000], (object)["agent_id"=> 301,"location_id"=> 156,"total"=> 10000], (object)["agent_id"=> 305,"location_id"=> 0,"total"=> 10000], (object)["agent_id"=> 306,"location_id"=> 148,"total"=> 10000], (object)["agent_id"=> 303,"location_id"=> 0,"total"=> 10000] ]; foreach($agents as $agent){ $agent->locations = []; foreach($locations as $location){ $location = clone $location; $location->transactions = []; foreach($records as $r){ if($r->agent_id == $agent->id && $location->xid == $r->location_id){ $location->transactions[] = $r; } } $agent->locations[] = $location; } } print_r($agents);

Abusive script

This script was stopped while abusing our resources

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.110.0030.00518.41
8.3.100.0090.00016.87
8.3.90.0080.00016.73
8.3.80.0000.00917.97
8.3.70.0060.00916.48
8.3.60.0120.00618.55
8.3.50.0070.01016.81
8.3.40.0040.01121.90
8.3.30.0140.00019.24
8.3.20.0070.00024.18
8.3.10.0040.00424.66
8.3.00.0050.00326.16
8.2.230.0130.00620.94
8.2.220.0140.00424.06
8.2.210.0170.00326.77
8.2.200.0090.00016.75
8.2.190.0100.01016.88
8.2.180.0090.01218.21
8.2.170.0080.00818.80
8.2.160.0100.00322.96
8.2.150.0070.00025.66
8.2.140.0060.00324.66
8.2.130.0080.00026.16
8.2.120.0040.00422.06
8.2.110.0060.00319.45
8.2.100.0080.00318.03
8.2.90.0100.00317.63
8.2.80.0250.00517.38
8.2.70.0240.00917.25
8.2.60.0270.00317.38
8.2.50.0320.00317.35
8.2.40.0230.00417.25
8.2.30.0240.00417.63
8.2.20.0210.00517.50
8.2.10.0240.00417.50
8.2.00.0200.00717.63
8.1.290.0060.00330.84
8.1.280.0140.00025.92
8.1.270.0000.00724.66
8.1.260.0030.00526.35
8.1.250.0040.00428.09
8.1.240.0030.00622.59
8.1.230.0040.00722.59
8.1.220.0230.00517.25
8.1.210.0290.00017.38
8.1.200.0240.00417.25
8.1.190.0190.00717.09
8.1.180.0210.00717.00
8.1.170.0270.00017.13
8.1.160.0230.00517.12
8.1.150.0150.01217.25
8.1.140.0240.00717.00
8.1.130.0230.00717.13
8.1.120.0220.00417.00
8.1.110.0240.00317.47
8.1.100.0270.00017.00
8.1.90.0160.01117.38
8.1.80.0110.01517.25
8.1.70.0280.00017.13
8.1.60.0250.00417.25
8.1.50.0240.00317.10
8.1.40.0210.00617.38
8.1.30.0200.00817.47
8.1.20.0230.00517.38
8.1.10.0200.00817.38
8.1.00.0230.00617.09
8.0.300.0240.00316.50
8.0.290.0240.00316.63
8.0.280.0250.00316.49
8.0.270.0200.01316.48
8.0.260.0170.01016.36
8.0.250.0210.00616.48
8.0.240.0220.00716.63
8.0.230.0220.00516.50
8.0.220.0190.01016.21
8.0.210.0190.00916.63
8.0.200.0200.00816.60
8.0.190.0230.00516.63
8.0.180.0280.00016.49
8.0.170.0370.00016.35
8.0.160.0240.00516.36
8.0.150.0210.00916.50
8.0.140.0250.00316.49
8.0.130.0160.01216.50
8.0.120.0220.00616.60
8.0.110.0290.00016.60
8.0.100.0260.00316.63
8.0.90.0250.00316.63
8.0.80.0180.01116.50
8.0.70.0260.00016.50
8.0.60.0250.00716.63
8.0.50.0260.00416.38
8.0.30.0250.00316.88
8.0.20.0230.00516.74
8.0.10.0220.00716.59

preferences:
71.4 ms | 403 KiB | 5 Q