3v4l.org

run code in 300+ PHP versions simultaneously
<?php $str = 'I only want the first 60 words of $output that has been uploaded 100 words to the database to be shown on my page, what is the simplest way for me to do this? I want $output[]="description to only fetch first 60 words from the database. ** I have tried a lot method but isnt working for me** I only want the first 60 words of $output that has been uploaded 100 words to the database to be shown on my page, what is the simplest way for me to do this? I want $output[]="description to only fetch first 60 words from the database. ** I have tried a lot method but isnt working for me**'; echo count(explode(" ", $str)) . " words in string\n\n"; echo "first 60 is:\n" . implode(" ", array_slice(explode(" ", $str), 0, 60));

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.120.0130.00720.32
8.4.110.0100.01018.54
8.4.100.0060.01018.86
8.4.90.0050.01020.36
8.4.80.0130.00917.68
8.4.70.0130.00817.92
8.4.60.0110.01118.75
8.4.50.0100.00917.54
8.4.40.0090.00919.08
8.4.30.0090.00619.24
8.4.20.0140.00720.79
8.4.10.0030.00617.73
8.3.250.0050.00418.73
8.3.240.0100.01016.64
8.3.230.0110.00816.42
8.3.220.0100.00818.84
8.3.210.0130.00616.55
8.3.200.0070.00116.63
8.3.190.0100.00920.85
8.3.180.0090.00616.53
8.3.170.0120.00616.98
8.3.160.0110.00716.30
8.3.150.0150.00417.41
8.3.140.0040.00416.54
8.3.130.0100.00016.58
8.3.120.0100.00618.83
8.3.110.0000.00920.94
8.3.100.0070.00316.41
8.3.90.0040.00426.77
8.3.80.0090.00316.63
8.3.70.0150.00616.63
8.3.60.0140.00318.30
8.3.50.0050.00817.36
8.3.40.0060.01218.81
8.3.30.0110.00318.64
8.3.20.0000.00820.77
8.3.10.0050.00323.56
8.3.00.0000.00822.40
8.2.290.0090.00720.63
8.2.280.0150.00618.26
8.2.270.0110.00716.45
8.2.260.0040.00419.10
8.2.250.0030.00617.17
8.2.240.0030.00618.80
8.2.230.0050.00522.58
8.2.220.0040.00424.06
8.2.210.0000.00726.77
8.2.200.0090.00316.36
8.2.190.0120.00616.63
8.2.180.0110.00718.41
8.2.170.0110.00418.96
8.2.160.0070.00722.96
8.2.150.0040.00424.18
8.2.140.0070.00024.66
8.2.130.0080.00019.65
8.2.120.0070.00026.35
8.2.110.0060.00320.36
8.2.100.0070.00717.66
8.2.90.0000.00820.59
8.2.80.0000.00918.05
8.2.70.0080.00417.93
8.2.60.0000.00818.09
8.2.50.0040.00418.10
8.2.40.0060.00319.30
8.2.30.0040.00419.32
8.2.20.0000.00817.94
8.2.10.0090.00019.32
8.2.00.0000.00818.31
8.1.330.0110.00821.80
8.1.320.0110.00716.21
8.1.310.0110.00716.55
8.1.300.0000.00818.35
8.1.290.0080.00030.84
8.1.280.0140.01025.92
8.1.270.0060.00320.43
8.1.260.0070.00026.35
8.1.250.0050.00228.09
8.1.240.0070.00323.73
8.1.230.0090.00621.02
8.1.220.0000.00817.74
8.1.210.0060.00319.00
8.1.200.0060.00617.35
8.1.190.0060.00317.25
8.1.180.0050.00318.10
8.1.170.0000.00918.65
8.1.160.0000.00718.90
8.1.150.0000.00718.77
8.1.140.0000.00818.96
8.1.130.0000.00820.14
8.1.120.0070.00017.52
8.1.110.0000.00717.36
8.1.100.0040.00417.43
8.1.90.0000.00717.45
8.1.80.0040.00417.43
8.1.70.0030.00317.46
8.1.60.0030.00717.50
8.1.50.0060.00317.54
8.1.40.0040.00417.43
8.1.30.0060.00617.55
8.1.20.0060.00317.61
8.1.10.0000.00817.51
8.1.00.0030.00617.46
8.0.300.0000.00719.90
8.0.290.0060.00316.63
8.0.280.0030.00518.45
8.0.270.0000.00717.14
8.0.260.0000.00618.45
8.0.250.0030.00316.84
8.0.240.0000.00616.85
8.0.230.0040.00416.84
8.0.220.0040.00416.91
8.0.210.0040.00416.88
8.0.200.0040.00416.84
8.0.190.0050.00216.87
8.0.180.0000.00816.91
8.0.170.0040.00416.92
8.0.160.0000.00716.96
8.0.150.0080.00016.66
8.0.140.0050.00316.72
8.0.130.0000.00513.32
8.0.120.0000.00716.79
8.0.110.0080.00016.71
8.0.100.0040.00416.95
8.0.90.0050.00216.96
8.0.80.0080.00616.86
8.0.70.0040.00416.89
8.0.60.0070.00016.93
8.0.50.0070.00016.86
8.0.30.0120.00717.11
8.0.20.0100.00917.30
8.0.10.0070.00016.96
8.0.00.0100.01016.79
7.4.330.0000.00516.74
7.4.320.0060.00016.61
7.4.300.0000.00616.61
7.4.290.0030.00316.61
7.4.280.0040.00416.49
7.4.270.0030.00316.56
7.4.260.0030.00316.48
7.4.250.0070.00016.39
7.4.240.0000.00816.35
7.4.230.0030.00316.63
7.4.220.0070.00016.35
7.4.210.0100.00716.56
7.4.200.0030.00516.58
7.4.160.0090.00816.52
7.4.140.0120.00717.86
7.4.130.0150.00916.62
7.4.120.0120.00616.51
7.4.110.0090.00916.78
7.4.100.0070.01016.59
7.4.90.0070.01016.65
7.4.80.0090.01219.39
7.4.70.0030.01516.55
7.4.60.0120.00316.35
7.4.50.0030.01016.57
7.4.40.0000.01616.30
7.4.00.0090.00914.85
7.3.330.0020.00213.00
7.3.320.0000.00512.96
7.3.310.0000.00816.27
7.3.300.0000.00716.19
7.3.290.0000.00816.24
7.3.280.0090.00616.17
7.3.260.0120.00816.32
7.3.240.0080.00916.43
7.3.230.0190.00316.21
7.3.210.0120.00616.23
7.3.200.0110.00516.56
7.3.190.0060.00916.38
7.3.180.0110.00616.59
7.3.170.0080.00816.33
7.3.160.0040.01216.31
7.3.120.0070.01314.71
7.3.110.0030.01314.68
7.3.100.0060.00914.95
7.3.90.0040.00714.57
7.3.80.0050.00514.93
7.3.70.0090.00614.70
7.3.60.0090.00614.86
7.3.50.0130.00014.60
7.3.40.0000.01814.73
7.3.30.0120.00614.64
7.3.20.1340.01115.68
7.3.10.1080.00815.46
7.3.00.1280.00715.57
7.2.330.0150.00416.56
7.2.320.0170.03016.54
7.2.310.0130.00316.67
7.2.300.0120.00916.63
7.2.290.0060.01216.75
7.2.250.0030.01614.90
7.2.240.0080.01214.89
7.2.230.0090.00615.13
7.2.220.0070.00315.13
7.2.210.0070.01014.71
7.2.200.0030.00915.10
7.2.190.0030.01014.96
7.2.180.0070.00715.05
7.2.170.0090.00615.14
7.2.160.0140.01014.72
7.2.150.2610.00315.10
7.2.140.2830.00715.02
7.2.130.2320.00714.72
7.2.120.2440.00714.77
7.2.110.2200.00314.91
7.2.100.2160.00715.00
7.2.90.2570.01614.86
7.2.80.2640.00714.63
7.2.70.3640.01314.70
7.2.60.2700.00714.89
7.2.50.2760.00714.98
7.2.40.2730.00715.02
7.2.30.2690.01314.98
7.2.20.3150.00715.14
7.2.10.2830.00015.00
7.2.00.2770.00714.77
7.1.330.0130.00015.81
7.1.320.0100.00715.80
7.1.310.0070.01015.60
7.1.300.0100.00315.83
7.1.290.0000.01215.56
7.1.280.0000.01015.56
7.1.270.1270.00514.67
7.1.260.1420.00514.59
7.1.250.2490.01013.69

preferences:
28.33 ms | 403 KiB | 5 Q