3v4l.org

run code in 300+ PHP versions simultaneously
<?php /* ---- 目的 ---- 「同じ日じゃなければ分解して、新しい順にしたい」 というのが目的で、次の$arrを、後述の$newにしたいです。 */ $arr = array( array( 'time' => [1558582388567], // 2019/05/23 'action' => 'get', 'target_id' => 10, 'actor_id' => [87], 'type' => 'a', ), array( 'time' => [1558432437780, 1556542124867], // 2019/05/21, 2019/04/29 'action' => 'get', 'target_id' => 6, 'actor_id' => [9,51], 'type' => 'b', ), array( 'time' => [1556630974513, 1556630915257], // 2019/04/30, 2019/04/30 'action' => 'lose', 'target_id' => 76, 'actor_id' => [87,37], 'type' => 'a', ), ); /* ---- 目的に従って変化した内容 ---- ・$arr[1]には別の日(2019/05/21, 2019/04/29)が混じっているので、分解された。 ・「分解された2019/04/29」よりも、「$arr[2]の2019/04/30」の方が新しいので、並び順が変わった。 というのが$arrから$newへと変化した内容です。 ---- どんな風に使うのか? ---- 「同じ日に、同じアクションを、同じターゲットにした人たち」を1つの配列にまとめたい。 というのが実際の用途になります。 $arrは別の日が混じっている状態なので、同じ日に分解したいというわけです。 */ $new = array( array( // 変化なし 'time' => [1558582388567], // 2019/05/23 'action' => 'get', 'target_id' => 10, 'actor_id' => [87], 'type' => 'a', ), array( // 分解されて新しく作られた配列 'time' => [1558432437780], // 2019/05/21 'action' => 'get', 'target_id' => 6, 'actor_id' => [9], 'type' => 'b', ), array( // 変化なし 'time' => [1556630974513, 1556630915257], // 2019/04/30, 2019/04/30 'action' => 'lose', 'target_id' => 76, 'actor_id' => [87,37], 'type' => 'a', ), array( // 分解された元の配列 'time' => [1556542124867], // 2019/04/29 'action' => 'get', 'target_id' => 6, 'actor_id' => [51], 'type' => 'b', ), );

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.5.10.0110.00716.54
8.5.00.0120.00919.89
8.4.150.0020.00114.05
8.4.140.0090.01217.34
8.4.130.0110.00818.72
8.4.120.0110.00824.21
8.4.110.0040.00620.52
8.4.100.0110.00918.45
8.4.90.0170.00320.46
8.4.80.0130.00718.70
8.4.70.0140.00817.70
8.4.60.0050.00418.87
8.4.50.0020.00719.46
8.4.40.0080.00417.46
8.4.30.0090.00920.20
8.4.20.0100.01020.63
8.4.10.0000.00819.60
8.3.280.0130.00818.16
8.3.270.0080.01316.51
8.3.260.0040.00516.63
8.3.250.0080.00818.88
8.3.240.0130.00516.84
8.3.230.0090.01016.48
8.3.220.0060.00218.88
8.3.210.0090.00816.61
8.3.200.0060.00316.46
8.3.190.0080.01017.07
8.3.180.0060.00416.69
8.3.170.0110.00718.78
8.3.160.0040.01118.15
8.3.150.0120.00620.70
8.3.140.0090.00616.30
8.3.130.0050.00318.18
8.3.120.0080.00018.82
8.3.110.0090.00920.94
8.3.100.0040.00424.06
8.3.90.0080.00026.77
8.3.80.0060.00316.38
8.3.70.0120.00916.63
8.3.60.0120.00918.43
8.3.50.0120.00517.29
8.3.40.0150.00018.39
8.3.30.0090.00618.50
8.3.20.0060.00621.74
8.3.10.0030.00518.89
8.3.00.0090.00321.77
8.2.290.0120.00720.28
8.2.280.0090.01119.83
8.2.270.0140.00317.21
8.2.260.0140.00418.06
8.2.250.0120.00318.37
8.2.240.0030.00516.92
8.2.230.0060.00322.58
8.2.220.0040.00437.54
8.2.210.0040.00426.77
8.2.200.0090.00016.50
8.2.190.0150.00616.75
8.2.180.0100.01425.92
8.2.170.0070.01422.96
8.2.160.0150.00020.35
8.2.150.0040.00424.18
8.2.140.0030.00624.66
8.2.130.0040.00426.16
8.2.120.0080.00026.16
8.2.110.0080.00022.20
8.2.100.0090.00317.84
8.2.90.0030.00617.63
8.2.80.0000.01017.97
8.2.70.0080.00017.90
8.2.60.0040.00418.09
8.2.50.0030.00618.10
8.2.40.0050.00219.18
8.2.30.0040.00419.25
8.2.20.0070.00017.99
8.2.10.0000.00718.78
8.2.00.0050.00319.47
8.1.330.0100.00921.71
8.1.320.0140.00816.05
8.1.310.0090.00916.68
8.1.300.0130.00617.61
8.1.290.0060.00318.88
8.1.280.0000.01425.92
8.1.270.0080.00022.11
8.1.260.0040.00426.35
8.1.250.0060.00328.09
8.1.240.0030.00623.97
8.1.230.0040.00719.22
8.1.220.0040.00417.74
8.1.210.0080.00018.77
8.1.200.0030.00617.00
8.1.190.0000.00916.98
8.1.180.0000.00818.10
8.1.170.0040.00418.50
8.1.160.0040.00418.80
8.1.150.0000.00818.88
8.1.140.0000.00718.72
8.1.130.0000.00720.00
8.1.120.0000.00717.43
8.1.110.0040.00417.35
8.1.100.0040.00417.38
8.1.90.0070.00017.27
8.1.80.0000.00817.28
8.1.70.0040.00417.41
8.1.60.0040.00417.38
8.1.50.0000.00817.29
8.1.40.0000.00817.41
8.1.30.0090.00017.62
8.1.20.0040.00417.53
8.1.10.0060.00317.36
8.1.00.0030.00517.30
8.0.300.0040.00419.71
8.0.290.0060.00316.63
8.0.280.0030.00318.36
8.0.270.0070.00017.10
8.0.260.0070.00018.30
8.0.250.0100.00016.87
8.0.240.0080.00016.88
8.0.230.0030.00316.87
8.0.220.0030.00316.86
8.0.210.0000.00716.72
8.0.200.0040.00416.89
8.0.190.0000.00816.87
8.0.180.0000.00816.75
8.0.170.0040.00416.73
8.0.160.0040.00416.81
8.0.150.0040.00416.77
8.0.140.0040.00416.79
8.0.130.0000.00613.24
8.0.120.0090.00016.83
8.0.110.0000.00816.71
8.0.100.0040.00416.65
8.0.90.0080.00016.82
8.0.80.0100.01016.74
8.0.70.0040.00416.84
8.0.60.0040.00416.75
8.0.50.0050.00216.70
8.0.30.0080.00816.98
8.0.20.0100.01416.89
8.0.10.0000.00716.83
8.0.00.0090.01016.58
7.4.330.0000.00415.55
7.4.320.0030.00316.45
7.4.300.0070.00016.48
7.4.290.0040.00416.44
7.4.280.0030.00316.53
7.4.270.0030.00316.53
7.4.260.0000.00716.40
7.4.250.0000.00716.29
7.4.240.0060.00316.49
7.4.230.0000.00716.33
7.4.220.0000.00716.46
7.4.210.0080.00716.49
7.4.200.0000.00716.55
7.4.160.0070.01016.38
7.4.140.0120.00617.86
7.4.130.0120.00916.39
7.4.120.0040.01316.39
7.4.110.0150.00316.38
7.4.100.0040.01316.52
7.4.90.0130.00316.51
7.4.80.0070.01419.39
7.4.70.0060.01216.60
7.4.60.0070.01016.39
7.4.50.0070.00716.41
7.4.40.0130.00316.38
7.4.00.0060.01214.86
7.3.330.0030.00313.05
7.3.320.0030.00312.96
7.3.310.0030.00516.16
7.3.300.0030.00316.04
7.3.290.0030.00316.12
7.3.280.0060.00916.14
7.3.260.0130.00516.29
7.3.240.0080.00816.25
7.3.230.0100.00616.16
7.3.210.0110.00716.29
7.3.200.0170.00316.02
7.3.190.0060.00916.36
7.3.180.0120.00916.28
7.3.170.0120.00616.48
7.3.160.0120.00616.18
7.3.50.0050.00514.75
7.3.40.0070.00314.68
7.3.30.0160.00614.60
7.3.20.0150.00016.58
7.3.10.0070.00316.61
7.3.00.0130.00616.55
7.2.330.0120.00416.44
7.2.320.0070.01116.49
7.2.310.0170.00016.60
7.2.300.0120.00616.41
7.2.290.0100.00616.23
7.2.180.0090.00314.68
7.2.170.0060.00614.79
7.2.160.0180.00314.77
7.2.150.0080.00416.39
7.2.140.0080.00416.48
7.2.130.0140.00916.84
7.2.120.0060.00616.80
7.2.110.0060.00616.81
7.2.100.0080.00516.49
7.2.90.0030.01016.70
7.2.80.0060.00716.72
7.2.70.0070.00416.68
7.2.60.0080.00316.72
7.2.50.0100.01016.72
7.2.40.0060.00916.86
7.2.30.0070.00716.35
7.2.20.0000.01116.75
7.2.10.0110.00016.38
7.2.00.0060.00916.82
7.1.280.0000.01115.49
7.1.270.0100.01015.68
7.1.260.0040.00715.45
7.1.250.0060.00615.62

preferences:
40.75 ms | 403 KiB | 5 Q