3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr = array(array("id" => 1,"title" => "Hello World", "body" => "Hi Jude All this is my content"), array("id" => 2,"title" => "Hello World Boy", "body" => "Hi All this is my content Girl"), array("id" => 3,"title" => "Hello Kids", "body" => "Hi All this is my content Kid"), array("id" => 4,"title" => "Hello World Jude", "body" => "Hi All this is my content Jude"), array("id" => 5,"title" => "Hello World Jude January", "body" => "Hi All this is my content Jan"), array("id" => 6,"title" => "Hello World January June Lord", "body" => "Hi All this is my content Jan Jude Lord")); $str = "Hello world January jude"; function sort_most_needles(&$array, $str) { $needles = explode(" ", $str); usort($array, function ($a, $b) use ($needles) { return array_uintersect($needles, explode(" ", $b['title']), 'strcasecmp') <=> array_uintersect($needles, explode(" ", $a['title']), 'strcasecmp'); }); } sort_most_needles($arr, $str); var_export($arr);

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.140.0080.01517.75
8.4.130.0140.00718.03
8.4.120.0140.00520.64
8.4.110.0140.00620.49
8.4.100.0120.00818.83
8.4.90.0090.01020.59
8.4.80.0120.00818.76
8.4.70.0100.00618.13
8.4.60.0090.01218.44
8.4.50.0130.00817.98
8.4.40.0100.01019.32
8.4.30.0100.01018.32
8.4.20.0030.00618.83
8.4.10.0090.00017.96
8.3.270.0120.00916.39
8.3.260.0090.01016.62
8.3.250.0100.01118.74
8.3.240.0110.00816.66
8.3.230.0090.01016.49
8.3.220.0050.00419.07
8.3.210.0110.00816.79
8.3.200.0050.00516.52
8.3.190.0070.00717.26
8.3.180.0070.00218.66
8.3.170.0060.01216.91
8.3.160.0040.00416.70
8.3.150.0040.01517.27
8.3.140.0120.00616.45
8.3.130.0040.00418.43
8.3.120.0090.00018.93
8.3.110.0040.00420.94
8.3.100.0110.00716.68
8.3.90.0040.00426.77
8.3.80.0040.00816.91
8.3.70.0070.01416.63
8.3.60.0140.00418.34
8.3.50.0090.00922.10
8.3.40.0110.01118.84
8.3.30.0120.00618.58
8.3.20.0050.00322.14
8.3.10.0050.00322.10
8.3.00.0000.00923.68
8.2.290.0070.01220.34
8.2.280.0110.00420.09
8.2.270.0040.00416.58
8.2.260.0040.01119.04
8.2.250.0110.00716.75
8.2.240.0080.00017.11
8.2.230.0070.01022.58
8.2.220.0110.00424.06
8.2.210.0000.00826.77
8.2.200.0030.00616.75
8.2.190.0100.00616.63
8.2.180.0130.00325.92
8.2.170.0090.00619.04
8.2.160.0110.01122.96
8.2.150.0070.00025.66
8.2.140.0040.00424.66
8.2.130.0050.00326.16
8.2.120.0060.00326.16
8.2.110.0100.00022.08
8.2.100.0110.00618.03
8.2.90.0050.00317.91
8.2.80.0050.00317.97
8.2.70.0030.00618.05
8.2.60.0080.00018.22
8.2.50.0050.00318.10
8.2.40.0080.00021.20
8.2.30.0050.00319.36
8.2.20.0000.00718.17
8.2.10.0000.00819.39
8.2.00.0000.00821.19
8.1.330.0070.01221.75
8.1.320.0100.01116.28
8.1.310.0140.00316.62
8.1.300.0040.00417.79
8.1.290.0030.00930.84
8.1.280.0090.01225.92
8.1.270.0000.00820.82
8.1.260.0080.00026.35
8.1.250.0040.00428.09
8.1.240.0030.00722.18
8.1.230.0040.00822.75
8.1.220.0040.00417.79
8.1.210.0030.00518.77
8.1.200.0030.00717.38
8.1.190.0030.00617.38
8.1.180.0050.00518.10
8.1.170.0000.00818.64
8.1.160.0040.00418.81
8.1.150.0000.00818.91
8.1.140.0030.00520.85
8.1.130.0030.00320.08
8.1.120.0000.00717.49
8.1.110.0040.00417.36
8.1.100.0000.00717.33
8.1.90.0040.00717.51
8.1.80.0000.00817.36
8.1.70.0000.00817.47
8.1.60.0030.00617.64
8.1.50.0000.00717.58
8.1.40.0030.00617.54
8.1.30.0000.00817.61
8.1.20.0040.00417.68
8.1.10.0000.00717.55
8.1.00.0060.00617.53
8.0.300.0040.00419.43
8.0.290.0000.00816.88
8.0.280.0070.00018.35
8.0.270.0030.00316.89
8.0.260.0000.00620.01
8.0.250.0080.00317.00
8.0.240.0000.00717.04
8.0.230.0040.00417.05
8.0.220.0000.00717.02
8.0.210.0000.00717.01
8.0.200.0060.00016.99
8.0.190.0080.00016.94
8.0.180.0000.00816.84
8.0.170.0030.00516.83
8.0.160.0000.00716.87
8.0.150.0040.00416.82
8.0.140.0070.00016.88
8.0.130.0030.00313.37
8.0.120.0040.00416.88
8.0.110.0030.00516.81
8.0.100.0000.00816.96
8.0.90.0050.00216.81
8.0.80.0090.01216.91
8.0.70.0070.00016.79
8.0.60.0040.00416.94
8.0.50.0000.00716.80
8.0.30.0150.00416.98
8.0.20.0140.00517.05
8.0.10.0030.00516.91
8.0.00.0100.00716.97
7.4.330.0030.00315.55
7.4.320.0000.00616.45
7.4.300.0000.00716.52
7.4.290.0000.00716.56
7.4.280.0070.00016.53
7.4.270.0080.00016.54
7.4.260.0000.00816.42
7.4.250.0040.00416.58
7.4.240.0050.00216.58
7.4.230.0000.00716.45
7.4.220.0000.00716.53
7.4.210.0100.00416.62
7.4.200.0000.00716.38
7.4.130.0090.00916.61
7.4.120.0200.00516.40
7.4.110.0140.00316.50
7.4.100.0070.01116.34
7.4.90.0030.01416.43
7.4.80.0160.00319.39
7.4.70.0030.01316.73
7.4.60.0120.00316.49
7.4.50.0070.00716.32
7.4.40.0130.00416.41
7.4.00.0030.01314.79
7.3.330.0030.00316.45
7.3.320.0000.00613.30
7.3.310.0000.00816.39
7.3.300.0070.00016.42
7.3.290.0000.00616.26
7.3.280.0100.01016.20
7.3.260.0110.00816.50
7.3.230.0100.00716.43
7.3.210.0110.00916.45
7.3.200.0120.00916.46
7.3.190.0090.00616.32
7.3.180.0060.01016.32
7.3.170.0100.01316.44
7.3.160.0060.00916.58
7.3.80.0060.01014.58
7.3.70.0000.01214.36
7.3.60.0000.01214.76
7.3.50.0030.00914.49
7.3.40.0110.00014.34
7.3.30.0060.00614.63
7.3.20.0100.00616.19
7.3.10.0090.00316.50
7.3.00.0100.00316.65
7.2.330.0120.00616.77
7.2.320.0000.01716.61
7.2.310.0130.01016.82
7.2.300.0130.00316.65
7.2.290.0100.00716.79
7.2.210.0070.00715.07
7.2.200.0070.00714.50
7.2.190.0060.00614.36
7.2.180.0060.00614.70
7.2.170.0050.00814.60
7.2.160.0040.00814.76
7.2.150.0030.01016.59
7.2.140.0060.01016.23
7.2.130.0080.01216.79
7.2.120.0100.00316.71
7.2.110.0050.00816.74
7.2.100.0030.00916.39
7.2.90.0110.00316.62
7.2.80.0090.00416.74
7.2.70.0110.00416.93
7.2.60.0030.01016.44
7.2.50.0130.00016.75
7.2.40.0030.01016.91
7.2.30.0030.01016.71
7.2.20.0090.00416.60
7.2.10.0100.00316.63
7.2.00.0080.00516.50
7.1.310.0070.00415.69
7.1.300.0080.00415.57
7.1.290.0040.00815.77
7.1.280.0030.00915.68
7.1.270.0060.00615.64
7.1.260.0060.00615.47
7.1.250.0080.00815.47

preferences:
30.19 ms | 403 KiB | 5 Q