3v4l.org

run code in 300+ PHP versions simultaneously
<?php $string = "This is my test case for an example"; function splitStrByWords($sentence, $wordCount=2) { $words = array_chunk( explode(' ', $sentence), $wordCount ); return array_map( 'implode', $words, array_fill(0, sizeof($words), ' ') ); } var_export(splitStrByWords($string));

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.130.0140.00619.88
8.4.120.0050.00420.80
8.4.110.0040.00522.63
8.4.100.0070.01118.16
8.4.90.0120.00822.05
8.4.80.0140.00618.79
8.4.70.0110.00819.07
8.4.60.0140.00718.72
8.4.50.0150.00717.79
8.4.40.0140.00720.75
8.4.30.0160.00323.86
8.4.20.0070.01419.68
8.4.10.0160.00323.65
8.3.260.0130.00616.57
8.3.250.0150.00518.72
8.3.240.0110.00719.01
8.3.230.0050.00816.91
8.3.220.0130.00518.93
8.3.210.0130.00416.68
8.3.200.0060.00216.92
8.3.190.0090.00617.13
8.3.180.0100.00916.50
8.3.170.0070.01117.28
8.3.160.0140.00420.29
8.3.150.0130.00018.66
8.3.140.0040.00417.20
8.3.130.0060.00318.56
8.3.120.0080.00020.65
8.3.110.0160.00320.94
8.3.100.0130.00724.06
8.3.90.0080.00426.77
8.3.80.0060.00318.68
8.3.70.0060.01218.65
8.3.60.0120.00316.50
8.3.50.0040.01816.72
8.3.40.0040.01123.74
8.3.30.0090.00618.85
8.3.20.0060.00324.18
8.3.10.0040.00424.66
8.3.00.0100.00026.16
8.2.290.0130.00716.80
8.2.280.0130.00718.76
8.2.270.0000.00918.83
8.2.260.0030.00616.98
8.2.250.0030.00517.25
8.2.240.0070.00317.24
8.2.230.0060.00322.58
8.2.220.0080.00337.54
8.2.210.0060.00326.77
8.2.200.0060.00616.63
8.2.190.0110.01117.00
8.2.180.0110.01117.00
8.2.170.0120.00918.95
8.2.160.0070.00722.96
8.2.150.0060.00625.66
8.2.140.0040.00424.66
8.2.130.0040.00426.16
8.2.120.0040.00419.83
8.2.110.0070.00422.13
8.2.100.0110.00017.84
8.2.90.0040.00420.46
8.2.80.0050.00317.97
8.2.70.0060.00317.92
8.2.60.0000.00817.63
8.2.50.0100.00717.25
8.2.40.0100.00717.50
8.2.30.0080.00817.38
8.2.20.0170.00017.38
8.2.10.0170.00017.63
8.2.00.0150.00317.38
8.1.330.0050.00421.82
8.1.320.0130.00716.37
8.1.310.0040.01118.31
8.1.300.0110.00016.50
8.1.290.0080.00430.84
8.1.280.0120.00325.92
8.1.270.0050.00324.66
8.1.260.0150.00326.35
8.1.250.0040.00428.09
8.1.240.0140.00722.55
8.1.230.0030.00720.96
8.1.220.0050.00317.74
8.1.210.0000.00919.04
8.1.200.0050.00317.35
8.1.190.0030.00617.25
8.1.180.0130.00317.00
8.1.170.0120.00617.23
8.1.160.0150.00416.98
8.1.150.0070.01017.00
8.1.140.0080.00917.00
8.1.130.0170.00017.13
8.1.120.0150.00217.23
8.1.110.0120.00517.25
8.1.100.0120.00417.12
8.1.90.0160.00017.25
8.1.80.0130.00317.00
8.1.70.0170.00017.50
8.1.60.0160.00317.38
8.1.50.0220.00317.09
8.1.40.0140.00517.63
8.1.30.0150.00317.00
8.1.20.0150.00317.48
8.1.10.0130.00417.38
8.1.00.0180.00017.38
8.0.300.0050.00319.98
8.0.290.0070.00016.75
8.0.280.0110.00516.52
8.0.270.0160.00016.63
8.0.260.0090.00916.75
8.0.250.0000.01616.52
8.0.240.0060.01216.52
8.0.230.0050.01516.63
8.0.220.0170.00016.60
8.0.210.0140.00316.52
8.0.200.0080.01016.52
8.0.190.0130.00516.63
8.0.180.0120.00616.52
8.0.170.0110.00616.52
8.0.160.0180.00016.52
8.0.150.0140.00316.75
8.0.140.0150.00316.52
8.0.130.0060.01216.63
8.0.120.0110.00816.52
8.0.110.0180.00016.75
8.0.100.0110.00616.75
8.0.90.0130.00416.52
8.0.80.0110.00616.52
8.0.70.0160.00016.63
8.0.60.0090.00916.52
8.0.50.0120.00316.52
8.0.30.0130.00416.52
8.0.20.0160.00016.52
8.0.10.0100.00716.63

preferences:
27.13 ms | 403 KiB | 5 Q