3v4l.org

run code in 300+ PHP versions simultaneously
<?php $output = "hello Mary."; $suffix = "added text to crop on condition"; $output .=$suffix; //append suffix to output $condition = true; // change to false to simulate case where no cropping is needed if($condition){ $suffix_len = strlen($suffix); //length of the suffix $output_len = strlen($output); //length of the whole output (including suffix) //if suffix is found at the end of the output if(substr($output,$output_len-$suffix_len) == $suffix){ $output = substr($output,0,$output_len-$suffix_len); //crop } } echo $output;

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.0060.00920.21
8.5.00.0140.00819.94
8.4.160.0110.00923.97
8.4.150.0020.00114.05
8.4.140.0080.01217.75
8.4.130.0070.00217.72
8.4.120.0110.00820.52
8.4.110.0120.00722.38
8.4.100.0120.01017.55
8.4.90.0050.00417.83
8.4.80.0020.00617.78
8.4.70.0150.00517.55
8.4.60.0140.00717.58
8.4.50.0110.00917.70
8.4.40.0120.00823.71
8.4.30.0160.00322.38
8.4.20.0160.00317.64
8.4.10.0060.00319.42
8.3.280.0100.01018.41
8.3.270.0100.00916.66
8.3.260.0110.00516.61
8.3.250.0130.00518.70
8.3.240.0120.00716.55
8.3.230.0100.00816.39
8.3.220.0030.00517.25
8.3.210.0080.01116.52
8.3.200.0150.00416.36
8.3.190.0090.00617.31
8.3.180.0070.01218.47
8.3.170.0120.00616.57
8.3.160.0040.00416.62
8.3.150.0110.00717.34
8.3.140.0080.00818.53
8.3.130.0040.00418.39
8.3.120.0070.01120.61
8.3.110.0030.00620.94
8.3.100.0090.00024.06
8.3.90.0130.00726.77
8.3.80.0030.00618.43
8.3.70.0110.01116.75
8.3.60.0030.01718.43
8.3.50.0120.00923.06
8.3.40.0040.01118.91
8.3.30.0060.00918.68
8.3.20.0070.00020.36
8.3.10.0080.00021.91
8.3.00.0080.00019.85
8.2.290.0040.00520.59
8.2.280.0090.00720.17
8.2.270.0090.00616.46
8.2.260.0150.00318.77
8.2.250.0030.00516.33
8.2.240.0030.00618.76
8.2.230.0000.00922.58
8.2.220.0000.00837.54
8.2.210.0000.00826.77
8.2.200.0040.00716.50
8.2.190.0090.00916.63
8.2.180.0090.00916.38
8.2.170.0110.00322.96
8.2.160.0070.00721.19
8.2.150.0060.00324.18
8.2.140.0070.00024.66
8.2.130.0040.00422.30
8.2.120.0020.00526.35
8.2.110.0000.00921.17
8.2.100.0080.00417.56
8.2.90.0060.00317.88
8.2.80.0000.00818.61
8.2.70.0000.00817.63
8.2.60.0090.00017.50
8.2.50.0080.00017.63
8.2.40.0080.00020.59
8.2.30.0040.00421.10
8.2.20.0050.00317.84
8.2.10.0040.00418.07
8.2.00.0050.00317.95
8.1.330.0060.00318.62
8.1.320.0100.01215.91
8.1.310.0100.00716.72
8.1.300.0090.00618.41
8.1.290.0030.00630.84
8.1.280.0170.00725.92
8.1.270.0080.00023.81
8.1.260.0050.00328.09
8.1.250.0000.00728.09
8.1.240.0030.00619.13
8.1.230.0110.00017.83
8.1.220.0040.00417.74
8.1.210.0060.00318.77
8.1.200.0070.00317.13
8.1.190.0000.00817.23
8.1.180.0050.00318.10
8.1.170.0040.00418.34
8.1.160.0040.00422.06
8.1.150.0070.00018.90
8.1.140.0040.00419.63
8.1.130.0030.00317.70
8.1.120.0040.00417.44
8.1.110.0040.00417.46
8.1.100.0040.00417.42
8.1.90.0030.00817.39
8.1.80.0040.00417.39
8.1.70.0030.00517.48
8.1.60.0030.00617.50
8.1.50.0040.00417.43
8.1.40.0040.00417.41
8.1.30.0030.00517.66
8.1.20.0000.00817.63
8.1.10.0040.00417.45
8.1.00.0000.00817.31
8.0.300.0000.00718.77
8.0.290.0060.00316.75
8.0.280.0070.00018.50
8.0.270.0050.00217.33
8.0.260.0030.00317.32
8.0.250.0080.00016.98
8.0.240.0050.00216.86
8.0.230.0030.00316.89
8.0.220.0000.00716.80
8.0.210.0030.00316.88
8.0.200.0000.00616.79
8.0.190.0000.00716.91
8.0.180.0040.00416.71
8.0.170.0040.00416.84
8.0.160.0070.00016.84
8.0.150.0040.00416.73
8.0.140.0040.00416.84
8.0.130.0030.00313.24
8.0.120.0000.00816.80
8.0.110.0000.00716.67
8.0.100.0050.00316.89
8.0.90.0000.00716.78
8.0.80.0110.01116.80
8.0.70.0000.00816.86
8.0.60.0040.00416.73
8.0.50.0040.00416.82
8.0.30.0110.00916.80
8.0.20.0100.01017.40
8.0.10.0030.00516.96
8.0.00.0070.01016.90
7.4.330.0000.00515.08
7.4.320.0080.00016.60
7.4.300.0060.00016.58
7.4.290.0040.00416.50
7.4.280.0080.00016.45
7.4.270.0000.00716.62
7.4.260.0030.00316.57
7.4.250.0080.00016.43
7.4.240.0000.00716.51
7.4.230.0000.00716.61
7.4.220.0120.00816.56
7.4.210.0020.01316.49
7.4.200.0030.00316.35
7.4.160.0070.00716.40
7.4.150.0120.00617.40
7.4.140.0110.00817.86
7.4.130.0080.01016.61
7.4.120.0090.01016.58
7.4.110.0100.01316.41
7.4.100.0180.00416.41
7.4.90.0030.01416.54
7.4.80.0110.00719.39
7.4.70.0130.00316.51
7.4.60.0060.00916.45
7.4.50.0060.00916.26
7.4.40.0140.00316.54
7.4.30.0000.01516.45
7.4.00.0040.01214.93
7.3.330.0030.00313.13
7.3.320.0000.00613.14
7.3.310.0050.00216.23
7.3.300.0070.00016.10
7.3.290.0030.00316.25
7.3.280.0090.00716.24
7.3.270.0100.00717.40
7.3.260.0100.00716.30
7.3.250.0120.00716.37
7.3.240.0120.01016.42
7.3.230.0030.01316.39
7.3.210.0170.00016.50
7.3.200.0070.01316.27
7.3.190.0130.00316.32
7.3.180.0080.00816.24
7.3.170.0090.00916.52
7.3.160.0130.01116.28
7.3.120.0130.00614.78
7.3.110.0070.01014.44
7.3.100.0040.01514.95
7.3.90.0140.00014.80
7.3.80.0090.00915.05
7.3.70.0030.00614.77
7.3.60.0030.01014.70
7.3.50.0100.00014.87
7.3.40.0060.00614.61
7.3.30.0110.00014.63
7.3.20.0090.00616.71
7.3.10.0080.00816.62
7.3.00.0030.00916.82
7.2.330.0090.00916.70
7.2.320.0120.00616.68
7.2.310.0070.01016.41
7.2.300.0090.00916.62
7.2.290.0180.00316.72
7.2.250.0070.00715.08
7.2.240.0070.01315.13
7.2.230.0040.01214.86
7.2.220.0040.01115.12
7.2.210.0040.00814.93
7.2.200.0000.01215.02
7.2.190.0130.00314.86
7.2.180.0150.00015.21
7.2.170.0040.00815.13
7.2.160.0090.00614.85
7.2.150.0060.00916.76
7.2.140.0060.00317.02
7.2.130.0040.01516.58
7.2.120.0100.00716.97
7.2.110.0060.00616.90
7.2.100.0130.00416.70
7.2.90.0070.01116.56
7.2.80.0040.00716.95
7.2.70.0000.01016.77
7.2.60.0090.00616.99
7.2.50.0070.00716.75
7.2.40.0040.00717.04
7.2.30.0090.00616.68
7.2.20.0060.00316.99
7.2.10.0030.00716.84
7.2.00.0070.00716.89
7.1.330.0060.01215.95
7.1.320.0030.01015.91
7.1.310.0040.00715.95
7.1.300.0040.00815.52
7.1.290.0000.01415.92
7.1.280.0040.00715.82
7.1.270.0030.01015.89
7.1.260.0100.00315.89
7.1.250.0030.00915.93
7.1.240.0070.01015.66
7.1.230.0060.00615.95
7.1.220.0100.00615.88
7.1.210.0070.00315.47
7.1.200.0060.00515.89
7.1.190.0030.01315.71
7.1.180.0060.00615.69
7.1.170.0030.00515.90
7.1.160.0080.00615.99
7.1.150.0030.00915.61
7.1.140.0040.00415.95
7.1.130.0070.00315.85
7.1.120.0050.00315.49
7.1.110.0030.01015.89
7.1.100.0030.00915.64
7.1.90.0040.01115.79
7.1.80.0000.01315.87
7.1.70.0020.00816.47
7.1.60.0020.01017.78
7.1.50.0030.00915.77
7.1.40.0090.00415.87
7.1.30.0070.00715.82
7.1.20.0070.00715.96
7.1.10.0060.01015.68
7.1.00.0090.03919.04
7.0.330.0160.00015.25
7.0.320.0040.00715.27
7.0.310.0030.01015.54
7.0.300.0030.00815.64
7.0.290.0040.00715.40
7.0.280.0000.01315.43
7.0.270.0090.00615.46
7.0.260.0080.00415.50
7.0.250.0030.01015.43
7.0.240.0040.01115.47
7.0.230.0060.00615.42
7.0.220.0000.00915.24
7.0.210.0070.00715.36
7.0.200.0020.00816.03
7.0.190.0030.01015.29
7.0.180.0000.01515.45
7.0.170.0070.00715.53
7.0.160.0090.00315.59
7.0.150.0070.00715.45
7.0.140.0060.00315.39
7.0.130.0060.00915.60
7.0.120.0040.00715.21
7.0.110.0040.00715.25
7.0.100.0090.00615.60
7.0.90.0060.03817.79
7.0.80.0100.03517.77
7.0.70.0140.02917.72
7.0.60.0080.03417.80
7.0.50.0100.03617.92
7.0.40.0070.03916.96
7.0.30.0090.03216.72
7.0.20.0100.03116.86
7.0.10.0150.02716.97
7.0.00.0120.03316.98
5.6.400.0100.00314.31
5.6.390.0030.01014.62
5.6.380.0030.00914.07
5.6.370.0040.00714.50
5.6.360.0110.00014.32
5.6.350.0000.01114.24
5.6.340.0000.01414.21
5.6.330.0000.01214.20
5.6.320.0100.00314.38
5.6.310.0140.00014.18
5.6.300.0030.01014.33
5.6.290.0060.00614.36
5.6.280.0070.01014.47
5.6.270.0000.01114.31
5.6.260.0040.01114.46
5.6.250.0090.00614.30
5.6.240.0070.00714.47
5.6.230.0060.03917.40
5.6.220.0120.03317.36
5.6.210.0130.02817.55
5.6.200.0080.03617.58
5.6.190.0120.03217.82
5.6.180.0130.03417.82
5.6.170.0050.03817.69
5.6.160.0080.03217.89
5.6.150.0130.02817.71
5.6.140.0030.03617.86
5.6.130.0100.03317.58
5.6.120.0070.03717.69
5.6.110.0120.03217.83
5.6.100.0130.03017.81
5.6.90.0170.02517.74
5.6.80.0100.03217.44
5.6.70.0080.03517.39
5.6.60.0030.03717.38
5.6.50.0070.03217.42
5.6.40.0080.03117.32
5.6.30.0070.03217.35
5.6.20.0070.03317.32
5.6.10.0100.02817.34
5.6.00.0070.03717.31

preferences:
46.86 ms | 403 KiB | 5 Q