3v4l.org

run code in 300+ PHP versions simultaneously
#!/usr/bin/php <?php // Take your submitted output $jsonData = '{"msg":"OK","details":[{ "id":"1","score":"233","user_id":"4", "date":"2014-02-03 00:00:00"}, { "id":"2", "score":"1256","user_id":"5", "date":"2014-02-05 00:00:00"},{"id":"4", "score":"123", "user_id":"7", "date":"2014-03-04 00:00:00"},{ "id":"3", "score":"100", "user_id":"6", "date":"2014-03-08 00:00:00"},{ "id":"5", "score":"8", "user_id":"2", "date":"2014-03-13 00:00:00"}], "1st":"2014-02-03 00:00:00", "last":"2014-03-13 00:00:00"}'; // and convert it to an array $origArray=json_decode($jsonData); // We will want an array to hold data $weeklyDetails = array(); // Lets loop through each of your details foreach ($origArray->details as $detail){ // and get the week number $weekNo=date("W", strtotime($detail->date)); // and if we don't already have an array for that week if (! is_array($weeklyDetails["week $weekNo"]) ){ //create it $weeklyDetails["week $weekNo"] = array(); } // lets push the detail into that week array_push($weeklyDetails["week $weekNo"], $detail); } // Assign the new details $origArray->details = $weeklyDetails; // Convert back to json $jsonData = json_encode($origArray); // print it out. print($jsonData);

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.0070.00719.24
8.3.30.0000.01419.25
8.3.20.0000.00720.29
8.3.10.0050.00322.09
8.3.00.0040.00422.44
8.2.170.0110.00422.96
8.2.160.0140.00719.29
8.2.150.0080.00024.18
8.2.140.0080.00024.66
8.2.130.0080.00026.16
8.2.120.0080.00019.74
8.2.110.0040.00722.12
8.2.100.0110.00417.97
8.2.90.0060.00319.21
8.2.80.0040.00417.97
8.2.70.0060.00317.75
8.2.60.0040.00418.18
8.2.50.0070.00418.07
8.2.40.0040.00420.07
8.2.30.0060.00318.23
8.2.20.0040.00418.14
8.2.10.0040.00418.13
8.2.00.0050.00318.02
8.1.270.0060.00322.21
8.1.260.0040.00426.35
8.1.250.0000.00828.09
8.1.240.0070.01023.82
8.1.230.0040.00719.23
8.1.220.0040.00417.88
8.1.210.0090.00018.77
8.1.200.0000.01017.60
8.1.190.0040.00417.42
8.1.180.0030.00518.84
8.1.170.0040.00418.77
8.1.160.0000.00722.09
8.1.150.0100.00018.78
8.1.140.0000.00717.55
8.1.130.0070.00017.91
8.1.120.0040.00417.66
8.1.110.0080.00017.66
8.1.100.0000.00817.66
8.1.90.0000.00717.57
8.1.80.0050.00217.56
8.1.70.0030.00317.64
8.1.60.0060.00317.73
8.1.50.0070.00017.71
8.1.40.0040.00417.66
8.1.30.0080.00017.84
8.1.20.0080.00017.82
8.1.10.0030.00517.80
8.1.00.0030.00817.70
8.0.300.0080.00018.77
8.0.290.0040.00417.16
8.0.280.0030.00318.55
8.0.270.0040.00417.36
8.0.260.0030.00317.11
8.0.250.0040.00417.21
8.0.240.0000.00817.21
8.0.230.0000.00717.22
8.0.220.0040.00417.16
8.0.210.0000.00717.18
8.0.200.0060.00017.22
8.0.190.0060.00317.11
8.0.180.0000.00717.17
8.0.170.0040.00417.18
8.0.160.0000.00717.25
8.0.150.0000.00717.08
8.0.140.0040.00417.12
8.0.130.0000.00713.61
8.0.120.0030.00617.05
8.0.110.0050.00317.13
8.0.100.0030.00517.07
8.0.90.0070.00017.05
8.0.80.0060.00917.20
8.0.70.0040.00417.16
8.0.60.0070.00017.07
8.0.50.0000.00717.16
8.0.30.0090.01217.47
8.0.20.0140.00517.41
8.0.10.0070.00017.10
8.0.00.0080.01216.89
7.4.330.0050.00015.14
7.4.320.0080.00016.77
7.4.300.0030.00316.80
7.4.290.0080.00016.75
7.4.280.0050.00316.67
7.4.270.0000.00816.59
7.4.260.0070.00016.66
7.4.250.0050.00316.71
7.4.240.0030.00516.69
7.4.230.0000.00816.74
7.4.220.0030.01416.83
7.4.210.0030.01116.68
7.4.200.0030.00516.76
7.4.190.0030.00316.91
7.4.160.0060.00916.79
7.4.150.0090.00917.40
7.4.140.0130.00817.86
7.4.130.0120.00516.76
7.4.120.0100.00816.74
7.4.110.0150.00916.62
7.4.100.0060.01316.84
7.4.90.0140.00316.83
7.4.80.0070.01519.39
7.4.70.0080.00816.64
7.4.60.0000.01916.67
7.4.50.0000.00816.54
7.4.40.0030.00822.77
7.4.30.0130.00316.72
7.4.00.0080.00815.11
7.3.330.0070.00013.46
7.3.320.0030.00313.38
7.3.310.0070.00016.70
7.3.300.0000.00716.57
7.3.290.0110.00316.55
7.3.280.0100.00616.55
7.3.270.0070.01017.40
7.3.260.0140.01016.65
7.3.250.0060.01216.64
7.3.240.0070.01016.65
7.3.230.0120.01216.58
7.3.210.0110.01116.68
7.3.200.0160.00819.39
7.3.190.0100.00716.79
7.3.180.0060.01016.72
7.3.170.0090.00916.57
7.3.160.0070.01016.65
7.3.120.0070.01115.12
7.3.110.0080.01015.18
7.3.100.0080.01015.10
7.3.90.0030.01214.99
7.3.80.0070.00914.93
7.3.70.0060.00315.15
7.3.60.0060.00414.88
7.3.50.0050.00715.14
7.3.40.0040.01115.16
7.3.30.0050.00814.97
7.3.20.0060.00616.71
7.3.10.0060.00316.86
7.3.00.0110.00416.79
7.2.330.0030.01416.84
7.2.320.0070.01116.99
7.2.310.0050.01016.95
7.2.300.0090.00616.97
7.2.290.0030.02016.98
7.2.250.0070.01115.18
7.2.240.0080.01115.37
7.2.230.0090.00815.45
7.2.220.0050.00915.43
7.2.210.0050.01015.34
7.2.200.0090.00515.24
7.2.190.0050.01215.30
7.2.180.0050.00715.03
7.2.170.0030.00615.34
7.2.160.0100.00615.08
7.2.150.0070.01117.14
7.2.140.0100.00717.01
7.2.130.0050.00816.91
7.2.120.0000.01516.96
7.2.110.0100.00717.18
7.2.100.0060.00917.23
7.2.90.0060.00917.13
7.2.80.0090.00616.94
7.2.70.0000.01117.12
7.2.60.0040.01117.23
7.2.50.0060.00916.91
7.2.40.0050.00517.27
7.2.30.0060.00617.15
7.2.20.0070.00717.09
7.2.10.0030.00616.98
7.2.00.0090.00518.40
7.1.330.0030.01016.01
7.1.320.0020.01016.01
7.1.310.0040.01315.90
7.1.300.0030.01116.06
7.1.290.0040.00715.95
7.1.280.0020.01016.04
7.1.270.0080.00416.00
7.1.260.0040.00915.99
7.1.250.0080.00815.93
7.1.240.0000.01715.84
7.1.230.0090.00615.95
7.1.220.0000.01315.91
7.1.210.0030.01315.93
7.1.200.0030.00915.76
7.1.190.0030.00616.04
7.1.180.0030.01016.00
7.1.170.0080.00615.88
7.1.160.0060.00915.93
7.1.150.0080.00515.75
7.1.140.0070.00715.92
7.1.130.0090.00316.08
7.1.120.0030.00915.93
7.1.110.0040.01115.95
7.1.100.0090.00617.30
7.1.90.0000.01615.90
7.1.80.0030.00615.95
7.1.70.0020.01216.75
7.1.60.0050.01417.83
7.1.50.0030.01416.35
7.1.40.0000.01715.88
7.1.30.0030.01216.03
7.1.20.0000.01515.71
7.1.10.0040.01515.87
7.1.00.0050.02719.19
7.0.330.0040.01215.46
7.0.320.0030.00715.63
7.0.310.0080.00415.52
7.0.300.0030.01015.66
7.0.290.0040.00415.52
7.0.280.0100.00315.70
7.0.270.0080.00015.59
7.0.260.0110.00415.29
7.0.250.0030.00615.47
7.0.240.0000.01415.48
7.0.230.0000.01415.68
7.0.220.0030.01015.25
7.0.210.0110.00415.74
7.0.200.0060.00616.23
7.0.190.0120.00315.66
7.0.180.0090.00615.70
7.0.170.0060.00615.60
7.0.160.0100.00715.86
7.0.150.0040.01115.71
7.0.140.0070.03918.75
7.0.130.0130.00315.50
7.0.120.0140.00315.38
7.0.110.0090.00615.40
7.0.100.0230.04217.68
7.0.90.0120.03917.73
7.0.80.0040.04917.82
7.0.70.0050.04317.84
7.0.60.0050.02817.71
7.0.50.0230.04618.08
7.0.40.0000.04716.94
7.0.30.0030.03716.73
7.0.20.0150.02716.89
7.0.10.0030.03816.90
7.0.00.0030.04716.86
5.6.400.0070.00714.83
5.6.390.0100.00614.88
5.6.380.0070.00714.46
5.6.370.0040.00814.75
5.6.360.0000.01414.72
5.6.350.0000.00914.63
5.6.340.0030.00914.82
5.6.330.0030.01014.54
5.6.320.0100.00714.36
5.6.310.0080.00814.91
5.6.300.0000.01514.59
5.6.290.0030.01014.86
5.6.280.0070.04017.89
5.6.270.0090.00914.60
5.6.260.0070.00714.74
5.6.250.0130.03817.60
5.6.240.0030.04417.70
5.6.230.0080.03017.59
5.6.220.0130.04017.60
5.6.210.0070.04417.61
5.6.200.0030.04917.89
5.6.190.0110.02217.81
5.6.180.0050.04617.87
5.6.170.0050.05217.78
5.6.160.0080.04017.81
5.6.150.0100.04117.79
5.6.140.0090.03717.88
5.6.130.0050.04317.81
5.6.120.0070.02717.97
5.6.110.0070.02617.82
5.6.100.0090.03117.87
5.6.90.0020.03317.84
5.6.80.0070.04817.50
5.6.70.0060.04517.45
5.6.60.0030.03117.50
5.6.50.0110.03817.50
5.6.40.0090.02517.64
5.6.30.0100.04317.55
5.6.20.0030.02917.57
5.6.10.0080.02517.51
5.6.00.0080.03917.40
5.5.380.0050.04017.47
5.5.370.0090.04617.52
5.5.360.0030.02617.46
5.5.350.0070.04617.49
5.5.340.0050.03017.74
5.5.330.0080.03917.71
5.5.320.0080.04117.61
5.5.310.0080.04817.74
5.5.300.0110.04017.51
5.5.290.0080.03817.74
5.5.280.0050.03717.79
5.5.270.0070.04217.68
5.5.260.0060.04017.66
5.5.250.0060.04317.36
5.5.240.0100.03017.35
5.5.230.0050.04617.16
5.5.220.0020.02417.48
5.5.210.0080.03017.25
5.5.200.0090.04017.50
5.5.190.0070.02617.29
5.5.180.0100.03417.30
5.5.170.0070.01014.54
5.5.160.0030.02717.46
5.5.150.0070.04217.46
5.5.140.0100.04217.24
5.5.130.0070.02517.35
5.5.120.0100.01817.21
5.5.110.0050.04517.33
5.5.100.0030.02817.38
5.5.90.0070.04217.37
5.5.80.0050.04117.43
5.5.70.0060.02817.26
5.5.60.0070.03017.41
5.5.50.0110.03617.26
5.5.40.0030.02817.24
5.5.30.0050.02517.34
5.5.20.0090.03317.32
5.5.10.0060.04017.38
5.5.00.0070.02517.31
5.4.450.0080.04015.46
5.4.440.0150.03715.37
5.4.430.0150.03715.42
5.4.420.0090.04015.07
5.4.410.0020.02615.30
5.4.400.0050.04415.23
5.4.390.0070.04315.26
5.4.380.0070.03715.12
5.4.370.0070.04015.11
5.4.360.0050.03515.05
5.4.350.0080.03515.23
5.4.340.0050.02815.15
5.4.330.0060.00611.35
5.4.320.0060.03515.05
5.4.310.0100.03415.08
5.4.300.0050.02415.26
5.4.290.0020.03515.20
5.4.280.0120.02315.04
5.4.270.0000.03515.03
5.4.260.0080.02815.16
5.4.250.0050.03215.22
5.4.240.0070.03715.15
5.4.230.0050.03515.09
5.4.220.0050.03715.01
5.4.210.0120.03714.88
5.4.200.0070.03515.15
5.4.190.0110.03415.01
5.4.180.0070.03315.13
5.4.170.0080.02815.15
5.4.160.0070.02214.95
5.4.150.0070.03314.91
5.4.140.0100.04313.61
5.4.130.0050.04213.73
5.4.120.0030.03913.87
5.4.110.0030.02813.85
5.4.100.0060.02013.87
5.4.90.0070.03713.79
5.4.80.0090.03413.87
5.4.70.0030.02513.87
5.4.60.0030.03713.85
5.4.50.0030.04413.73
5.4.40.0100.03813.79
5.4.30.0050.03713.87
5.4.20.0080.03813.75
5.4.10.0070.02713.74
5.4.00.0100.02013.55
5.3.290.0080.03412.71
5.3.280.0020.02312.66
5.3.270.0030.02512.69
5.3.260.0030.03312.71
5.3.250.0030.04312.59
5.3.240.0020.04312.51
5.3.230.0020.02712.62
5.3.220.0050.02612.64
5.3.210.0030.03312.50
5.3.200.0100.02312.64
5.3.190.0000.02612.62
5.3.180.0080.02212.73
5.3.170.0120.03212.66
5.3.160.0100.01912.68
5.3.150.0090.03912.65
5.3.140.0080.04012.68
5.3.130.0050.04212.66
5.3.120.0080.03112.67
5.3.110.0070.03512.65
5.3.100.0050.02312.24
5.3.90.0010.03612.23
5.3.80.0020.04212.40
5.3.70.0100.03512.24
5.3.60.0050.02312.25
5.3.50.0020.04012.37
5.3.40.0040.02612.26
5.3.30.0000.02312.39
5.3.20.0000.02812.08
5.3.10.0080.03711.98
5.3.00.0030.02612.09
5.2.170.0070.02711.32
5.2.160.0030.06311.32
5.2.150.0030.03311.32
5.2.140.0070.04711.32
5.2.130.0070.06011.32
5.2.120.0070.05311.32
5.2.110.0070.05311.32
5.2.100.0070.02711.32
5.2.90.0030.03011.32
5.2.80.0030.05711.32
5.2.70.0130.05711.32
5.2.60.0070.06011.32
5.2.50.0030.04311.32
5.2.40.0070.06011.32
5.2.30.0100.06011.32
5.2.20.0070.04311.32
5.2.10.0070.06011.32
5.2.00.0100.02711.32
5.1.60.0070.05011.32
5.1.50.0030.05311.32
5.1.40.0000.05011.32
5.1.30.0100.05011.32
5.1.20.0000.06011.32
5.1.10.0030.02311.32
5.1.00.0030.05311.32
5.0.50.0000.04711.32
5.0.40.0070.04011.32
5.0.30.0070.05711.32
5.0.20.0030.03311.32
5.0.10.0030.03711.32
5.0.00.0000.03711.32
4.4.90.0030.03311.32
4.4.80.0000.02711.32
4.4.70.0030.03711.32
4.4.60.0030.03011.32
4.4.50.0030.03311.32
4.4.40.0030.02311.32
4.4.30.0030.02011.32
4.4.20.0070.01711.32
4.4.10.0030.01711.32
4.4.00.0070.04311.32
4.3.110.0030.03311.32
4.3.100.0000.03011.32
4.3.90.0030.03311.32
4.3.80.0000.02711.32
4.3.70.0030.01711.32
4.3.60.0000.01711.32
4.3.50.0000.03311.32
4.3.40.0070.05011.32
4.3.30.0070.01711.32
4.3.20.0030.03011.32
4.3.10.0030.02311.32
4.3.00.0100.02311.32

preferences:
46.81 ms | 400 KiB | 5 Q