3v4l.org

run code in 300+ PHP versions simultaneously
<?php function wordSafeSplit(string $text, int $pieces = 2) { $wordsPerPiece = ceil(str_word_count($text) / $pieces); return preg_split( "~([^\w'-]*[\w'-]+[^\w' -]*){{$wordsPerPiece}}\K\s?~", $text, $pieces ); } $text = "The Quick : Brown Fox Jumped Over The Lazy / Dog"; var_export(wordSafeSplit($text));

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.00.0160.00620.08
8.4.150.0010.00214.05
8.4.140.0030.00617.59
8.4.130.0130.00718.42
8.4.120.0070.00724.43
8.4.110.0110.01018.94
8.4.100.0110.00918.71
8.4.90.0040.00418.87
8.4.80.0090.01118.85
8.4.70.0050.00418.27
8.4.60.0110.01018.81
8.4.50.0130.00818.91
8.4.40.0080.00818.70
8.4.30.0130.00618.63
8.4.20.0180.00019.69
8.4.10.0030.00619.71
8.3.280.0120.00820.43
8.3.270.0080.01116.55
8.3.260.0100.00816.66
8.3.250.0100.01018.82
8.3.240.0160.00417.11
8.3.230.0090.01016.78
8.3.220.0090.00918.98
8.3.210.0050.00316.55
8.3.200.0070.00216.78
8.3.190.0100.00917.29
8.3.180.0060.00517.13
8.3.170.0130.00620.50
8.3.160.0110.00717.19
8.3.150.0070.01117.03
8.3.140.0060.00316.84
8.3.130.0080.00018.65
8.3.120.0040.00420.74
8.3.110.0080.00820.94
8.3.100.0070.00316.57
8.3.90.0080.00026.77
8.3.80.0030.00619.36
8.3.70.0110.01116.75
8.3.60.0060.01016.82
8.3.50.0080.01221.27
8.3.40.0260.01317.50
8.3.30.0270.01017.50
8.3.20.0260.00717.50
8.3.10.0290.00317.50
8.3.00.0190.01217.63
8.2.290.0130.00520.36
8.2.280.0050.00518.75
8.2.270.0130.00319.10
8.2.260.0090.00016.82
8.2.250.0030.00518.71
8.2.240.0100.01016.99
8.2.230.0050.00322.58
8.2.220.0000.00924.06
8.2.210.0070.01426.77
8.2.200.0000.00918.88
8.2.190.0150.00416.58
8.2.180.0200.01216.13
8.2.170.0220.01517.50
8.2.160.0330.00417.59
8.2.150.0320.00317.63
8.2.140.0350.00317.75
8.2.130.0330.00319.25
8.2.120.0300.00317.50
8.2.110.0310.01017.48
8.2.100.0320.00717.63
8.2.90.0250.01117.50
8.2.80.0300.00617.63
8.2.70.0240.00817.63
8.2.60.0310.00317.63
8.2.50.0270.00717.72
8.2.40.0180.01517.63
8.2.30.0180.01219.11
8.2.20.0280.00317.12
8.2.10.0240.00717.48
8.2.00.0190.01317.63
8.1.330.0110.00822.18
8.1.320.0110.00816.59
8.1.310.0110.00717.86
8.1.300.0080.00018.57
8.1.290.0030.00730.84
8.1.280.0110.00825.92
8.1.270.0350.00417.25
8.1.260.0250.01217.38
8.1.250.0320.00617.50
8.1.240.0260.01117.13
8.1.230.0110.02317.36
8.1.220.0370.00017.50
8.1.210.0210.00917.25
8.1.200.0260.00717.13
8.1.190.0340.00417.25
8.1.180.0180.01817.35
8.1.170.0290.00016.97
8.1.160.0280.00317.38
8.1.150.0260.00717.10
8.1.140.0220.00617.21
8.1.130.0220.01417.22
8.1.120.0250.00617.63
8.1.110.0160.01617.25
8.1.100.0260.00717.38
8.1.90.0000.01917.13
8.1.80.0100.00719.09
8.1.70.0110.00719.13
8.1.60.0130.00319.50
8.1.50.0140.00518.88
8.1.40.0100.01019.22
8.1.30.0030.01519.50
8.1.20.0030.01419.38
8.1.10.0130.00619.07
8.1.00.0110.00718.92

preferences:
32.26 ms | 403 KiB | 5 Q