3v4l.org

run code in 300+ PHP versions simultaneously
<?php function reverse($string) { $substr1 = ""; $substr2 = ""; $strLength = strlen($string) - 1; $strLengthHalf = round(strlen($string) / 2); for ($i = 0; $i < round(strlen($string) / 2); $i++) { $substr1 .= $string[$strLength-$i]; $substr2 .= $string[$strLengthHalf - $i]; } var_dump($substr1); var_dump($substr2); return $string = $substr1.$substr2; } var_dump(reverse('12345'));

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.3.60.0140.00718.68
8.3.50.0080.01216.71
8.3.40.0190.00018.96
8.3.30.0100.00319.21
8.3.20.0060.00320.33
8.3.10.0040.00423.79
8.3.00.0060.00319.38
8.2.180.0080.00816.63
8.2.170.0110.00322.96
8.2.160.0070.00719.29
8.2.150.0040.00424.18
8.2.140.0120.00324.66
8.2.130.0080.00526.16
8.2.120.0080.00022.09
8.2.110.0110.00622.25
8.2.100.0090.00317.75
8.2.90.0000.00819.34
8.2.80.0080.00017.97
8.2.70.0030.00517.63
8.2.60.0090.00018.16
8.2.50.0030.00518.07
8.2.40.0030.00620.00
8.2.30.0040.00418.18
8.2.20.0040.00417.80
8.2.10.0060.00318.29
8.2.00.0000.00717.73
8.1.280.0070.00725.92
8.1.270.0080.00022.17
8.1.260.0050.00326.35
8.1.250.0020.00528.09
8.1.240.0090.00023.97
8.1.230.0040.00719.29
8.1.220.0060.00317.78
8.1.210.0040.00418.77
8.1.200.0030.00617.12
8.1.190.0030.00517.35
8.1.180.0040.00418.10
8.1.170.0000.00818.46
8.1.160.0040.00422.07
8.1.150.0070.00018.93
8.1.140.0040.00417.46
8.1.130.0000.00717.77
8.1.120.0000.00717.52
8.1.110.0070.00017.51
8.1.100.0000.00717.34
8.1.90.0000.00717.48
8.1.80.0030.00417.36
8.1.70.0000.00717.42
8.1.60.0040.00417.61
8.1.50.0000.00817.47
8.1.40.0030.00517.56
8.1.30.0040.00417.70
8.1.20.0070.00017.70
8.1.10.0000.00717.57
8.1.00.0030.00517.55
8.0.300.0060.00318.77
8.0.290.0050.00316.75
8.0.280.0050.00318.50
8.0.270.0040.00417.29
8.0.260.0030.00317.29
8.0.250.0000.00716.99
8.0.240.0000.00717.14
8.0.230.0000.00716.95
8.0.220.0030.00317.12
8.0.210.0030.00317.08
8.0.200.0080.00017.05
8.0.190.0000.00717.14
8.0.180.0040.00417.01
8.0.170.0040.00416.93
8.0.160.0030.00317.03
8.0.150.0000.00716.93
8.0.140.0050.00316.88
8.0.130.0030.00313.41
8.0.120.0030.00617.00
8.0.110.0080.00017.02
8.0.100.0020.00517.01
8.0.90.0040.00417.05
8.0.80.0130.01017.02
8.0.70.0040.00416.97
8.0.60.0000.00716.92
8.0.50.0000.00816.90
8.0.30.0100.01517.27
8.0.20.0090.00917.41
8.0.10.0050.00217.11
8.0.00.0100.00816.93
7.4.330.0000.00515.14
7.4.320.0060.00316.48
7.4.300.0030.00316.66
7.4.290.0000.00816.47
7.4.280.0030.00316.57
7.4.270.0080.00016.43
7.4.260.0050.00316.57
7.4.250.0040.00416.47
7.4.240.0050.00216.64
7.4.230.0000.00716.77
7.4.220.0180.00016.63
7.4.210.0080.00516.50
7.4.200.0000.00816.56
7.4.160.0100.00616.39
7.4.150.0060.01217.40
7.4.140.0080.01317.86
7.4.130.0120.00816.61
7.4.120.0100.01016.51
7.4.110.0070.01116.66
7.4.100.0060.00916.66
7.4.90.0100.00716.70
7.4.80.0110.00619.39
7.4.70.0060.01216.77
7.4.60.0160.00316.68
7.4.50.0000.00616.31
7.4.40.0080.00816.45
7.4.30.0090.01216.49
7.4.00.0080.00515.14
7.3.330.0000.00513.45
7.3.320.0050.00013.46
7.3.310.0000.00716.49
7.3.300.0030.00316.35
7.3.290.0040.01016.49
7.3.280.0080.00916.45
7.3.270.0160.00317.40
7.3.260.0090.00816.46
7.3.250.0070.01016.61
7.3.240.0090.00916.51
7.3.230.0050.01116.39
7.3.210.0070.01116.71
7.3.200.0000.01619.39
7.3.190.0090.00616.55
7.3.180.0140.00316.50
7.3.170.0000.01716.47
7.3.160.0070.01016.39
7.3.00.0040.00716.79
7.2.330.0090.00916.62
7.2.320.0070.01016.63
7.2.310.0090.00916.56
7.2.300.0120.01216.55
7.2.290.0040.01716.75
7.2.130.0120.00616.95
7.2.120.0070.00716.95
7.2.110.0110.00016.95
7.2.100.0070.00716.64
7.2.90.0110.00316.95
7.2.80.0030.01216.92
7.2.70.0000.01416.84
7.2.60.0090.00616.91
7.2.50.0040.01116.84
7.2.40.0140.00017.10
7.2.30.0090.00616.71
7.2.20.0090.00617.05
7.2.10.0070.00416.61
7.2.00.0030.00918.23
7.1.250.0080.00015.85
7.1.240.0050.00315.77
7.1.230.0090.00315.79
7.1.220.0090.00615.68
7.1.210.0060.00615.96
7.1.200.0040.00415.77
7.1.190.0030.01015.88
7.1.180.0070.00715.72
7.1.170.0070.01015.61
7.1.160.0040.00815.77
7.1.150.0030.00915.54
7.1.140.0030.00715.80
7.1.130.0030.00615.73
7.1.120.0080.00615.83
7.1.110.0000.01215.75
7.1.100.0080.00516.86
7.1.90.0070.00715.93
7.1.80.0140.00015.52
7.1.70.0010.00616.36
7.1.60.0050.01217.56
7.1.50.0090.00916.36
7.1.40.0070.00715.99
7.1.30.0120.00015.79
7.1.20.0080.00315.70
7.1.10.0090.00315.46
7.1.00.0030.04419.03
7.0.330.0040.01115.31
7.0.320.0060.00315.20
7.0.310.0110.00315.33
7.0.300.0000.01315.27
7.0.290.0080.00615.43
7.0.280.0000.01215.40
7.0.270.0000.01115.27
7.0.260.0070.00715.57
7.0.250.0040.00715.55
7.0.240.0070.00315.42
7.0.230.0070.00415.43
7.0.220.0000.01315.46
7.0.210.0060.00615.14
7.0.200.0020.00716.13
7.0.190.0130.00315.43
7.0.180.0060.00315.43
7.0.170.0070.00315.44
7.0.160.0070.00715.29
7.0.150.0060.00615.54
7.0.140.0040.04018.77
7.0.130.0070.00315.40
7.0.120.0030.00615.47
7.0.110.0000.00915.60
7.0.100.0060.00715.29
7.0.90.0030.00915.43
7.0.80.0040.00415.17
7.0.70.0060.00615.45
7.0.60.0030.04117.68
7.0.50.0050.04216.68
7.0.40.0080.03816.80
7.0.30.0180.04016.75
7.0.20.0150.02816.85
7.0.10.0040.02416.92
7.0.00.0080.04416.87
5.6.380.0080.00414.09
5.6.370.0080.00314.61
5.6.360.0040.00414.18
5.6.350.0030.00914.68
5.6.340.0100.00313.89
5.6.330.0080.00014.56
5.6.320.0060.00613.91
5.6.310.0060.00614.30
5.6.300.0060.00814.12
5.6.290.0040.00714.31
5.6.280.0090.03617.61
5.6.270.0040.00714.38
5.6.260.0030.00614.21
5.6.250.0030.00614.47
5.6.240.0080.00314.47
5.6.230.0100.00314.38
5.6.220.0000.01114.47
5.6.210.0080.02817.38
5.6.200.0070.02216.30
5.6.190.0080.02317.38
5.6.180.0170.04217.37
5.6.170.0150.04817.52
5.6.160.0070.04117.39
5.6.150.0080.03416.21
5.6.140.0000.02716.21
5.6.130.0050.04816.22
5.6.120.0060.02417.81
5.6.110.0070.04417.75
5.6.100.0010.02617.56
5.6.90.0120.03717.60
5.6.80.0080.04117.18
5.6.70.1820.02217.24
5.6.60.0000.01014.19
5.6.50.0080.00414.39
5.6.40.0060.00614.17
5.6.30.0070.00314.18
5.6.20.0090.00314.23
5.6.10.0090.00014.25
5.6.00.0060.00614.11
5.5.380.0030.00611.60
5.5.370.0030.00311.60
5.5.360.0040.00411.60
5.5.350.0050.03615.97
5.5.340.0030.03714.84
5.5.330.0090.03515.97
5.5.320.0150.02715.99
5.5.310.0150.04315.96
5.5.300.0060.03014.81
5.5.290.0030.02914.79
5.5.280.0080.02216.25
5.5.270.0080.04316.23
5.5.260.0040.02316.18
5.5.250.0070.03016.15
5.5.240.0100.02215.93
5.5.230.0000.01011.60
5.5.220.0080.00011.60
5.5.210.0060.00011.60
5.5.200.0000.00611.60
5.5.190.0050.00311.60
5.5.180.0080.00011.60
5.5.170.0050.00511.60
5.5.160.0030.00311.60
5.5.150.0040.00411.60
5.5.140.0030.00711.60
5.5.130.0070.00011.60
5.5.120.0000.00711.60
5.5.110.0000.00811.60
5.5.100.0030.00511.60
5.5.90.0040.00411.60
5.5.80.0000.00911.60
5.5.70.0000.00811.60
5.5.60.0090.00011.60
5.5.50.0030.00711.60
5.5.40.0080.00311.60
5.5.30.0030.00311.60
5.5.20.0060.00311.60
5.5.10.0070.00311.60
5.5.00.0000.01111.60
5.4.450.0400.02915.61
5.4.440.0540.03515.47
5.4.430.0430.03815.63
5.4.420.0510.03115.60
5.4.410.0300.03315.47
5.4.400.0380.03615.38
5.4.390.0250.03515.44
5.4.380.0310.03615.38
5.4.370.0330.03715.48
5.4.360.0390.02915.48
5.4.350.0450.04315.29
5.4.340.0040.02011.81
5.4.330.0040.00411.60
5.4.320.0070.02012.05
5.4.310.0050.02112.05
5.4.300.0050.02112.05
5.4.290.0070.02312.05
5.4.280.0050.02512.00
5.4.270.0020.03212.00
5.4.260.0080.02612.00
5.4.250.0050.02812.00
5.4.240.0110.03712.00
5.4.230.0080.03212.00
5.4.220.0080.04211.99
5.4.210.0090.05712.00
5.4.200.0100.04312.00
5.4.190.0090.04411.99
5.4.180.0080.03111.99
5.4.170.0070.04012.00
5.4.160.0040.02211.99
5.4.150.0090.03711.99
5.4.140.0090.02011.83
5.4.130.0070.01911.83
5.4.120.0090.01711.81
5.4.110.0070.01911.81
5.4.100.0040.02311.81
5.4.90.0070.02111.81
5.4.80.0050.02211.81
5.4.70.0050.02611.81
5.4.60.0090.01711.80
5.4.50.0080.01911.80
5.4.40.0060.02511.80
5.4.30.0040.02111.80
5.4.20.0080.01711.80
5.4.10.0070.01911.80
5.4.00.0050.01911.54
5.3.290.0070.02012.20
5.3.280.0040.02312.15
5.3.270.0080.02212.16
5.3.260.0050.02212.16
5.3.250.0050.02312.16
5.3.240.0060.02012.16
5.3.230.0060.02212.15
5.3.220.0050.02112.14
5.3.210.0050.02212.14
5.3.200.0040.02312.14
5.3.190.0060.02012.14
5.3.180.0040.02112.14
5.3.170.0020.02512.14
5.3.160.0040.02412.14
5.3.150.0030.02412.13
5.3.140.0070.01912.13
5.3.130.0060.02012.13
5.3.120.0070.01912.13
5.3.110.0060.02012.13
5.3.100.0060.02211.86
5.3.90.0050.02511.85
5.3.80.0060.02011.85
5.3.70.0060.02011.85
5.3.60.0040.02311.84
5.3.50.0070.02411.81
5.3.40.0080.02011.81
5.3.30.0040.02111.79
5.3.20.0080.01911.68
5.3.10.0050.01911.67
5.3.00.0040.02211.66
5.2.170.0060.01710.42
5.2.160.0070.02110.42
5.2.150.0040.02410.42
5.2.140.0080.01410.41
5.2.130.0040.01710.40
5.2.120.0040.01710.39
5.2.110.0010.02010.40
5.2.100.0030.01910.40
5.2.90.0030.01810.40
5.2.80.0050.01910.39
5.2.70.0020.01810.40
5.2.60.0040.01610.37
5.2.50.0060.02410.36
5.2.40.0070.02110.35
5.2.30.0060.02110.33
5.2.20.0040.01710.33
5.2.10.0050.02210.28
5.2.00.0030.02110.21
5.1.60.0020.0159.85
5.1.50.0050.0129.85
5.1.40.0040.0139.84
5.1.30.0040.01310.02
5.1.20.0020.01810.03
5.1.10.0060.0179.89
5.1.00.0060.0169.89
5.0.50.0020.0149.13
5.0.40.0040.0119.06
5.0.30.0050.0158.96
5.0.20.0050.0108.95
5.0.10.0020.0148.94
5.0.00.0030.0168.93
4.4.90.0030.0098.19
4.4.80.0040.0088.18
4.4.70.0030.0098.18
4.4.60.0020.0118.18
4.4.50.0040.0098.18
4.4.40.0040.0138.15
4.4.30.0030.0098.18
4.4.20.0010.0108.22
4.4.10.0020.0118.22
4.4.00.0020.0158.18
4.3.110.0030.0088.13
4.3.100.0020.0138.13
4.3.90.0040.0108.12
4.3.80.0020.0178.09
4.3.70.0020.0128.12
4.3.60.0020.0128.11
4.3.50.0020.0108.11
4.3.40.0010.0158.07
4.3.30.0020.0097.46
4.3.20.0010.0117.45
4.3.10.0030.0087.43
4.3.00.0070.0169.23

preferences:
38 ms | 400 KiB | 5 Q