3v4l.org

run code in 300+ PHP versions simultaneously
<?php $format = function ($money) { $pieces = explode('.', $money); $dollars = $pieces[0]; if (count($pieces) > 1) { $cents = $pieces[1]; } else { $cents = false; } //1000000.50 //1000000 50 //0000001 $str = strrev($dollars); $out = ''; for ($i = 0; $i < strlen($str); $i++) { if ($i % 3 == 0 && $i !== 0) { $out .= ','; } $out .= $str[$i]; } $out = '$' . strrev($out) . ($cents === false ? ('.' . $cents) : ''); return $out; }; echo $format('100000');

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.0150.00616.46
8.3.50.0120.00918.19
8.3.40.0090.00618.79
8.3.30.0120.00319.09
8.3.20.0070.00020.16
8.3.10.0040.00423.66
8.3.00.0080.00020.75
8.2.180.0140.00716.38
8.2.170.0110.00322.96
8.2.160.0100.00720.45
8.2.150.0040.00424.18
8.2.140.0000.00724.66
8.2.130.0110.00726.16
8.2.120.0040.00420.70
8.2.110.0030.00622.15
8.2.100.0120.00017.97
8.2.90.0050.00319.30
8.2.80.0050.00317.97
8.2.70.0030.00717.63
8.2.60.0080.00018.05
8.2.50.0060.00318.07
8.2.40.0030.00520.07
8.2.30.0000.00718.25
8.2.20.0040.00417.82
8.2.10.0040.00418.11
8.2.00.0000.00817.73
8.1.270.0080.00023.92
8.1.260.0040.00426.35
8.1.250.0090.00028.09
8.1.240.0050.00523.88
8.1.230.0110.00019.10
8.1.220.0030.00517.74
8.1.210.0000.00818.77
8.1.200.0080.00017.23
8.1.190.0040.00417.22
8.1.180.0050.00318.10
8.1.170.0030.00618.38
8.1.160.0050.00321.99
8.1.150.0000.00718.55
8.1.140.0040.00417.32
8.1.130.0050.00217.89
8.1.120.0030.00317.34
8.1.110.0040.00417.49
8.1.100.0070.00017.47
8.1.90.0000.00717.46
8.1.80.0030.00517.34
8.1.70.0000.00717.45
8.1.60.0070.00017.55
8.1.50.0050.00317.43
8.1.40.0040.00417.36
8.1.30.0030.00617.61
8.1.20.0000.00917.56
8.1.10.0000.00717.57
8.1.00.0030.00617.41
8.0.300.0080.00018.77
8.0.290.0000.00716.63
8.0.280.0030.00318.35
8.0.270.0000.00717.25
8.0.260.0000.00617.25
8.0.250.0060.00016.92
8.0.240.0070.00016.95
8.0.230.0000.00716.79
8.0.220.0000.00716.81
8.0.210.0030.00316.85
8.0.200.0070.00016.90
8.0.190.0040.00416.92
8.0.180.0030.00516.96
8.0.170.0080.00016.88
8.0.160.0070.00016.78
8.0.150.0050.00216.89
8.0.140.0040.00416.87
8.0.130.0000.00513.33
8.0.120.0080.00016.82
8.0.110.0080.00016.91
8.0.100.0070.00016.92
8.0.90.0000.00716.77
8.0.80.0120.00316.89
8.0.70.0000.00716.76
8.0.60.0000.00716.75
8.0.50.0040.00416.79
8.0.30.0130.00617.17
8.0.20.0110.00717.40
8.0.10.0040.00417.07
8.0.00.0050.01216.99
7.4.330.0000.00515.12
7.4.320.0060.00016.57
7.4.300.0060.00016.60
7.4.290.0040.00416.54
7.4.280.0040.00416.35
7.4.270.0000.00716.39
7.4.260.0070.00316.47
7.4.250.0070.00016.38
7.4.240.0000.00716.58
7.4.230.0030.00316.50
7.4.220.0070.01116.66
7.4.210.0120.00316.66
7.4.200.0030.00316.33
7.4.160.0120.00316.65
7.4.150.0090.01317.40
7.4.140.0100.00817.86
7.4.130.0150.00316.61
7.4.120.0120.00516.59
7.4.110.0060.00916.59
7.4.100.0070.01016.55
7.4.90.0060.01516.57
7.4.80.0000.02019.39
7.4.70.0100.00716.41
7.4.60.0060.01216.52
7.4.50.0000.00616.41
7.4.40.0060.00916.43
7.4.30.0150.00416.65
7.4.10.0000.01815.20
7.4.00.0040.01314.96
7.3.330.0000.00613.18
7.3.320.0060.00013.24
7.3.310.0050.00316.37
7.3.300.0030.00316.28
7.3.290.0030.01216.25
7.3.280.0060.01116.37
7.3.270.0130.00317.40
7.3.260.0130.00316.59
7.3.250.0100.00716.50
7.3.240.0150.00716.54
7.3.230.0130.00616.54
7.3.210.0100.00716.64
7.3.200.0100.00719.39
7.3.190.0030.01716.63
7.3.180.0120.00416.37
7.3.170.0040.01216.68
7.3.160.0110.00516.48
7.3.130.0090.00914.94
7.3.120.0100.00514.97
7.3.110.0060.01214.66
7.3.100.0100.00314.85
7.3.90.0070.00714.71
7.3.80.0090.00614.76
7.3.70.0090.00614.78
7.3.60.0030.01014.95
7.3.50.0090.00314.87
7.3.40.0070.00715.05
7.3.30.0040.01114.63
7.3.20.0030.00916.79
7.3.10.0130.00316.27
7.3.00.0030.01416.88
7.2.330.0070.01016.79
7.2.320.0070.01016.47
7.2.310.0090.00916.76
7.2.300.0040.01116.60
7.2.290.0060.01516.76
7.2.260.0120.00614.98
7.2.250.0100.00614.69
7.2.240.0040.01115.05
7.2.230.0060.00915.04
7.2.220.0120.00314.84
7.2.210.0090.00315.08
7.2.200.0030.01215.04
7.2.190.0040.00415.22
7.2.180.0030.01014.88
7.2.170.0060.01015.22
7.2.160.0040.01114.91
7.2.150.0030.01017.06
7.2.140.0120.00316.99
7.2.130.0100.01016.56
7.2.120.0120.00016.79
7.2.110.0120.00017.01
7.2.100.0040.01116.84
7.2.90.0060.01316.78
7.2.80.0030.01317.04
7.2.70.0070.01017.06
7.2.60.0100.00717.01
7.2.50.0090.00917.04
7.2.40.0070.00416.82
7.2.30.0000.01716.90
7.2.20.0090.00616.75
7.2.10.0070.00716.97
7.2.00.0060.01016.79
7.1.330.0030.01015.68
7.1.320.0050.00415.99
7.1.310.0000.01515.89
7.1.300.0030.01015.84
7.1.290.0040.01515.43
7.1.280.0060.00315.77
7.1.270.0030.00615.72
7.1.260.0080.00416.05
7.1.250.0070.00715.76
7.1.240.0110.00416.06
7.1.230.0070.00715.80
7.1.220.0000.01615.92
7.1.210.0060.01015.96
7.1.200.0070.00715.97
7.1.190.0000.01515.76
7.1.180.0140.00315.87
7.1.170.0070.01015.80
7.1.160.0060.00615.88
7.1.150.0000.01015.85
7.1.140.0060.00915.55
7.1.130.0120.00015.59
7.1.120.0040.01115.84
7.1.110.0040.01115.93
7.1.100.0030.01015.98
7.1.90.0060.00615.80
7.1.80.0060.00315.63
7.1.70.0060.00616.54
7.1.60.0040.00916.21
7.1.50.0090.00916.22
7.1.40.0080.00815.68
7.1.30.0030.01015.54
7.1.20.0030.00715.69
7.1.10.0040.00815.80
7.1.00.0100.03819.18
7.0.330.0120.00615.43
7.0.320.0080.00815.40
7.0.310.0060.00615.63
7.0.300.0030.01315.16
7.0.290.0090.00615.63
7.0.280.0040.00415.51
7.0.270.0000.01115.52
7.0.260.0080.00815.27
7.0.250.0100.00615.54
7.0.240.0030.00715.45
7.0.230.0090.00315.42
7.0.220.0000.01415.52
7.0.210.0000.01715.62
7.0.200.0050.00516.08
7.0.190.0040.00715.34
7.0.180.0070.00715.23
7.0.170.0040.01115.57
7.0.160.0060.00615.43
7.0.150.0100.00315.38
7.0.140.0060.04118.78
7.0.130.0070.01015.63
7.0.120.0030.00715.50
7.0.110.0100.04217.74
7.0.100.0080.04317.75
7.0.90.0040.02417.55
7.0.80.0060.02017.57
7.0.70.0050.02317.58
7.0.60.0030.04117.71
7.0.50.0050.02617.79
7.0.40.0050.04316.65
7.0.30.0020.02416.73
7.0.20.0070.02216.52
7.0.10.0040.03416.54
7.0.00.0050.02016.63
5.6.400.0000.01614.35
5.6.390.0120.00014.43
5.6.380.0000.01514.57
5.6.370.0040.00814.67
5.6.360.0030.01014.79
5.6.350.0070.00714.79
5.6.340.0070.00714.31
5.6.330.0040.01114.16
5.6.320.0060.00614.64
5.6.310.0040.00714.30
5.6.300.0070.00714.70
5.6.290.0100.00314.41
5.6.280.0100.03717.64
5.6.270.0070.00714.68
5.6.260.0060.02517.66
5.6.250.0060.04117.57
5.6.240.0100.04017.45
5.6.230.0030.03317.40
5.6.220.0020.04717.46
5.6.210.0030.02317.50
5.6.200.0040.04717.66
5.6.190.0050.03017.51
5.6.180.0070.03017.46
5.6.170.0080.03817.39
5.6.160.0050.04717.32
5.6.150.0070.02317.64
5.6.140.0100.03717.47
5.6.130.0080.03217.48
5.6.120.0030.03217.57
5.6.110.0100.03217.53
5.6.100.0050.04217.51
5.6.90.0000.04617.33
5.6.80.0080.04017.28
5.6.70.0050.04517.14
5.6.60.0080.03817.28
5.6.50.0090.03717.25
5.6.40.0070.03617.17
5.6.30.0050.04417.12
5.6.20.0150.03717.22
5.6.10.0020.04517.14
5.6.00.0040.04317.10
5.5.380.0070.04015.99
5.5.370.0050.02015.99
5.5.360.0140.03815.78
5.5.350.0020.05016.03
5.5.340.0030.03816.31
5.5.330.0050.03116.44
5.5.320.0070.02016.42
5.5.310.0050.02316.32
5.5.300.0030.02516.09
5.5.290.0070.04216.24
5.5.280.0030.04816.16
5.5.270.0050.04216.11
5.5.260.0070.04216.34
5.5.250.0090.03716.03
5.5.240.0050.04115.63
5.5.230.0080.04415.83
5.5.220.0050.04316.03
5.5.210.0050.04415.81
5.5.200.0050.03515.98
5.5.190.0050.02615.81
5.5.180.0100.04016.07
5.5.170.0000.01414.15
5.5.160.0000.05015.62
5.5.150.0080.04115.96
5.5.140.0090.03516.02
5.5.130.0020.02915.79
5.5.120.0060.03515.73
5.5.110.0070.03915.76
5.5.100.0070.04016.03
5.5.90.0070.04215.84
5.5.80.0040.02815.79
5.5.70.0070.04215.79
5.5.60.0090.03715.88
5.5.50.0050.02315.82
5.5.40.0070.02315.63
5.5.30.0070.03915.76
5.5.20.0070.03215.91
5.5.10.0080.03815.72
5.5.00.0090.03415.75
5.4.450.0030.04615.65
5.4.440.0070.04015.71
5.4.430.0030.03815.63
5.4.420.0030.04115.73
5.4.410.0020.04015.58
5.4.400.0080.03015.57
5.4.390.0050.01915.48
5.4.380.0030.02315.52
5.4.370.0050.04215.65
5.4.360.0050.03715.49
5.4.350.0020.04315.59
5.4.340.0020.04015.57
5.4.330.0000.00611.96
5.4.320.0040.03715.47
5.4.310.0080.03915.47
5.4.300.0020.04415.60
5.4.290.0030.04215.48
5.4.280.0080.04115.48
5.4.270.0100.03215.56
5.4.260.0080.03815.59
5.4.250.0050.03315.46
5.4.240.0070.03715.47
5.4.230.0050.03115.47
5.4.220.0030.04215.54
5.4.210.0090.03415.48
5.4.200.0060.04115.60
5.4.190.0070.03515.47
5.4.180.0090.03715.59
5.4.170.0080.04215.47
5.4.160.0070.04215.48
5.4.150.0050.02215.64
5.4.140.0050.03614.21
5.4.130.0050.02514.29
5.4.120.0070.02214.17
5.4.110.0040.02114.18
5.4.100.0110.03014.16
5.4.90.0080.03314.25
5.4.80.0070.03814.30
5.4.70.0020.04314.30
5.4.60.0030.04014.24
5.4.50.0050.03714.24
5.4.40.0030.02314.28
5.4.30.0050.02814.15
5.4.20.0050.03814.29
5.4.10.0050.03814.26
5.4.00.0020.04013.85
5.3.290.0070.03813.33
5.3.280.0030.02313.20
5.3.270.0070.04013.28
5.3.260.0050.03213.28
5.3.250.0000.03113.28
5.3.240.0090.03313.40
5.3.230.0030.02313.31
5.3.220.0060.02313.27
5.3.210.0070.03913.26
5.3.200.0050.01513.28
5.3.190.0060.04013.30
5.3.180.0060.04013.26
5.3.170.0060.03313.37
5.3.160.0040.02513.32
5.3.150.0030.03813.26
5.3.140.0100.03313.25
5.3.130.0050.04213.25
5.3.120.0060.04013.23
5.3.110.0050.02913.29
5.3.100.0060.02313.01
5.3.90.0060.03313.01
5.3.80.0050.04013.02
5.3.70.0030.04013.03
5.3.60.0030.04013.02
5.3.50.0030.03912.96
5.3.40.0070.03812.96
5.3.30.0050.03312.94
5.3.20.0070.03512.83
5.3.10.0030.04212.80
5.3.00.0030.03712.86
5.2.170.0100.05011.93
5.2.160.0070.05711.93
5.2.150.0070.06011.93
5.2.140.0030.06311.93
5.2.130.0000.05711.93
5.2.120.0000.06711.93
5.2.110.0000.04311.93
5.2.100.0030.03711.93
5.2.90.0070.05711.93
5.2.80.0100.04311.93
5.2.70.0000.05011.93
5.2.60.0000.04011.93
5.2.50.0030.05311.93
5.2.40.0070.05711.93
5.2.30.0100.05711.93
5.2.20.0030.06011.93
5.2.10.0070.05311.93
5.2.00.0030.05711.93
5.1.60.0030.05311.93
5.1.50.0100.04711.93
5.1.40.0030.04011.93
5.1.30.0030.05011.93
5.1.20.0030.05311.93
5.1.10.0000.05711.93
5.1.00.0000.05711.93
5.0.50.0000.04711.93
5.0.40.0030.04011.93
5.0.30.0030.06311.93
5.0.20.0000.02311.93
5.0.10.0030.03311.93
5.0.00.0000.06011.93
4.4.90.0000.03011.93
4.4.80.0100.03011.93
4.4.70.0000.03311.93
4.4.60.0000.02311.93
4.4.50.0030.03011.93
4.4.40.0000.05011.93
4.4.30.0100.02711.93
4.4.20.0030.03711.93
4.4.10.0100.02711.93
4.4.00.0000.05711.93
4.3.110.0000.03711.93
4.3.100.0070.02711.93
4.3.90.0030.03311.93
4.3.80.0000.05011.93
4.3.70.0000.01711.93
4.3.60.0030.03011.93
4.3.50.0000.03711.93
4.3.40.0000.04711.93
4.3.30.0030.03011.93
4.3.20.0000.02011.93
4.3.10.0000.03011.93
4.3.00.0000.02311.93

preferences:
60.09 ms | 400 KiB | 5 Q