3v4l.org

run code in 300+ PHP versions simultaneously
<?php $queryBalance=[ (object)["balance"=>"-257,21","id_month"=>12,"year"=>"2017"], (object)["balance"=>"-257,21","id_month"=>1,"year"=>"2018"], (object)["balance"=>"-257,21","id_month"=>2,"year"=>"2018"], (object)["balance"=>"166,66","id_month"=>3,"year"=>"2018"], (object)["balance"=>"55","id_month"=>12,"year"=>"2017"], //(object)["balance"=>"0","id_month"=>1,"year"=>"2018"], (object)["balance"=>"0","id_month"=>2,"year"=>"2018"], (object)["balance"=>"55","id_month"=>3,"year"=>"2018"], (object)["balance"=>"-22257,21","id_month"=>12,"year"=>"2017"], (object)["balance"=>"-64609,14","id_month"=>1,"year"=>"2018"], (object)["balance"=>"-64609,14","id_month"=>2,"year"=>"2018"], (object)["balance"=>"-12234,89","id_month"=>3,"year"=>"2018"] ]; foreach($queryBalance as $row){ $uniques[$row->year.'-'.$row->id_month]=NULL; // determine all unique date groups } while($queryBalance){ $temp=[]; foreach($uniques as $date=>$null){ $first=current($queryBalance); // cache the element that is currently first in $queryBalance $temp[]=($date==$first->year.'-'.$first->id_month) ? array_shift($queryBalance)->balance : NULL; // extract from array, or store NULL without modifying $queryBalance } $result[]=$temp; } var_export($result);

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.0110.00924.14
8.4.110.0130.00720.63
8.4.100.0050.00417.81
8.4.90.0090.01120.53
8.4.80.0080.00117.86
8.4.70.0060.00218.00
8.4.60.0100.00918.79
8.4.50.0160.00320.63
8.4.40.0150.00317.99
8.4.30.0030.01017.66
8.4.20.0070.01521.97
8.4.10.0150.00617.55
8.3.250.0100.00818.90
8.3.240.0110.00317.19
8.3.230.0100.00916.89
8.3.220.0080.00017.16
8.3.210.0070.00620.82
8.3.200.0060.00216.83
8.3.190.0140.00617.18
8.3.180.0110.00818.42
8.3.170.0070.00717.25
8.3.160.0030.01518.46
8.3.150.0120.00618.37
8.3.140.0090.00017.13
8.3.130.0090.00918.41
8.3.120.0100.00618.96
8.3.110.0040.00420.94
8.3.100.0030.01324.06
8.3.90.0070.01126.77
8.3.80.0030.00617.97
8.3.70.0120.00918.20
8.3.60.0000.01418.68
8.3.50.0080.00818.44
8.3.40.0090.00918.79
8.3.30.0130.00618.67
8.3.20.0070.00020.30
8.3.10.0070.00723.70
8.3.00.0080.00019.69
8.2.290.0110.00120.34
8.2.280.0100.00818.50
8.2.270.0090.00917.22
8.2.260.0060.00316.68
8.2.250.0070.01016.81
8.2.240.0000.00917.47
8.2.230.0000.00922.58
8.2.220.0130.00337.54
8.2.210.0080.00026.77
8.2.200.0060.00616.63
8.2.190.0070.00716.58
8.2.180.0110.00718.48
8.2.170.0090.00622.96
8.2.160.0090.00620.47
8.2.150.0080.00024.18
8.2.140.0070.01024.66
8.2.130.0070.00019.83
8.2.120.0000.00726.35
8.2.110.0000.00819.30
8.2.100.0090.00317.91
8.2.90.0060.00322.28
8.2.80.0000.00817.97
8.2.70.0090.00018.04
8.2.60.0050.00317.93
8.2.50.0080.00018.16
8.2.40.0000.00920.63
8.2.30.0040.00419.30
8.2.20.0000.00718.11
8.2.10.0060.00318.04
8.2.00.0040.00418.37
8.1.330.0080.01122.11
8.1.320.0100.01016.25
8.1.310.0030.00518.57
8.1.300.0030.00619.90
8.1.290.0070.00430.84
8.1.280.0040.01425.92
8.1.270.0040.00422.05
8.1.260.0080.00026.35
8.1.250.0000.00828.09
8.1.240.0070.00321.11
8.1.230.0130.00319.01
8.1.220.0030.00617.74
8.1.210.0000.00818.88
8.1.200.0050.00317.48
8.1.190.0040.00417.36
8.1.180.0000.01018.10
8.1.170.0040.00418.64
8.1.160.0000.00718.93
8.1.150.0070.00020.39
8.1.140.0050.00217.71
8.1.130.0030.00319.07
8.1.120.0030.00517.48
8.1.110.0020.00517.39
8.1.100.0070.00017.47
8.1.90.0000.00817.30
8.1.80.0000.00717.46
8.1.70.0000.00717.51
8.1.60.0070.00417.61
8.1.50.0000.00917.43
8.1.40.0040.00417.52
8.1.30.0040.00417.71
8.1.20.0000.00817.50
8.1.10.0040.00417.57
8.1.00.0040.00817.49
8.0.300.0070.00019.92
8.0.290.0030.00716.75
8.0.280.0070.00018.46
8.0.270.0030.00717.17
8.0.260.0040.00416.89
8.0.250.0070.00317.00
8.0.240.0030.00316.99
8.0.230.0070.00017.02
8.0.220.0000.00816.97
8.0.210.0050.00216.93
8.0.200.0050.00316.98
8.0.190.0040.00417.04
8.0.180.0040.00416.96
8.0.170.0000.00817.00
8.0.160.0000.00816.88
8.0.150.0040.00416.92
8.0.140.0000.00716.82
8.0.130.0060.00013.38
8.0.120.0030.00517.02
8.0.110.0050.00316.80
8.0.100.0030.00316.83
8.0.90.0000.00716.75
8.0.80.0090.00616.93
8.0.70.0070.00017.08
8.0.60.0070.00016.79
8.0.50.0040.00416.91
8.0.30.0080.01117.11
8.0.20.0120.00717.40
8.0.10.0040.00417.16
8.0.00.0120.00716.84
7.4.330.0030.00315.55
7.4.320.0080.00016.52
7.4.300.0000.00616.66
7.4.290.0030.00316.59
7.4.280.0040.00416.42
7.4.270.0070.00016.62
7.4.260.0000.00716.52
7.4.250.0000.00716.50
7.4.240.0040.00416.54
7.4.230.0000.00816.51
7.4.220.0000.00716.47
7.4.210.0100.00616.68
7.4.200.0000.00816.64
7.4.150.0100.01717.40
7.4.140.0060.01217.86
7.4.130.0130.00816.43
7.4.120.0110.00916.54
7.4.110.0060.01016.79
7.4.100.0070.01116.50
7.4.90.0060.01216.79
7.4.80.0060.01819.39
7.4.70.0080.00916.52
7.4.60.0100.00716.67
7.4.50.0030.01316.58
7.4.40.0080.00816.55
7.4.00.0080.00815.21
7.3.330.0030.00313.19
7.3.320.0000.00713.21
7.3.310.0030.00316.50
7.3.300.0000.00616.34
7.3.290.0080.00816.37
7.3.280.0090.00616.41
7.3.270.0100.00617.40
7.3.260.0100.01016.43
7.3.240.0090.00916.46
7.3.230.0090.00616.48
7.3.210.0130.00316.32
7.3.200.0070.01316.30
7.3.190.0100.01216.44
7.3.180.0120.00416.42
7.3.170.0120.00416.41
7.3.160.0130.00716.56
7.2.330.0030.01316.66
7.2.320.0030.01316.49
7.2.310.0060.00916.66
7.2.300.0100.01016.86
7.2.290.0110.01116.66
7.2.60.0120.00916.92
7.2.20.0150.01719.79
7.2.10.0140.01619.76
7.2.00.0110.01319.75
7.1.200.0030.00716.01
7.1.140.0080.01618.80
7.1.130.0100.01018.57
7.1.120.0050.01718.77
7.1.110.0080.01118.24
7.1.100.0060.00918.34
7.1.90.0100.01018.14
7.1.80.0090.01318.25
7.1.70.0100.01117.10
7.1.60.0310.01835.06
7.1.50.0370.01534.89
7.1.40.0240.01734.20
7.1.30.0380.01634.46
7.1.20.0210.01634.60
7.1.10.0070.01016.64
7.1.00.0100.01316.57

preferences:
30.32 ms | 403 KiB | 5 Q