3v4l.org

run code in 300+ PHP versions simultaneously
<?php // convert decimal to base 2 without using base_convert or printf $base = 2; $decnum = 23; $num = 23; $stack = null; while( $num > 0) { $arr[] = $num % $base; // store remainder in array $num = floor($num/$base); // no integer division } var_dump($arr); $wrong = join('',$arr); var_dump($wrong); $cat = join('',array_reverse($arr)); var_dump($cat); printf("%b\n",$decnum); echo base_convert(23,10,2); // now using the stack while( $decnum > 0) { array_push($stack,($num % $base)); // store remainder on stack $decnum = floor($decnum/$base); // no integer division } for ($i=0,$max = count($stack);$i < $max; $i++) { echo array_pop($stack); } echo "\n";

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.0060.00918.43
8.3.50.0070.01521.97
8.3.40.0160.00618.88
8.3.30.0180.00319.09
8.3.20.0040.00420.51
8.3.10.0050.00322.25
8.3.00.0030.00622.46
8.2.180.0130.01016.88
8.2.170.0070.01322.96
8.2.160.0160.00321.06
8.2.150.0060.00324.18
8.2.140.0030.00624.66
8.2.130.0040.00426.16
8.2.120.0060.00619.48
8.2.110.0040.00422.23
8.2.100.0080.00417.91
8.2.90.0000.00819.34
8.2.80.0040.00418.05
8.2.70.0050.00317.75
8.2.60.0030.00518.18
8.2.50.0100.00018.07
8.2.40.0080.00018.34
8.2.30.0000.00718.14
8.2.20.0040.00417.91
8.2.10.0040.00417.90
8.2.00.0000.00817.84
8.1.280.0110.00725.92
8.1.270.0040.00422.14
8.1.260.0040.00426.35
8.1.250.0060.00328.09
8.1.240.0030.00623.96
8.1.230.0040.00719.22
8.1.220.0060.00317.88
8.1.210.0060.00318.77
8.1.200.0060.00617.25
8.1.190.0040.00417.41
8.1.180.0060.00318.85
8.1.170.0000.00818.52
8.1.160.0000.00722.09
8.1.150.0050.00318.62
8.1.140.0040.00417.43
8.1.130.0040.00417.85
8.1.120.0040.00417.46
8.1.110.0040.00417.48
8.1.100.0030.00517.35
8.1.90.0080.00017.46
8.1.80.0000.00717.54
8.1.70.0040.00417.39
8.1.60.0000.00817.63
8.1.50.0000.00717.55
8.1.40.0040.00417.59
8.1.30.0050.00317.71
8.1.20.0080.00017.61
8.1.10.0040.00417.67
8.1.00.0050.00317.61
8.0.300.0000.00718.77
8.0.290.0070.00017.28
8.0.280.0000.00718.50
8.0.270.0040.00417.26
8.0.260.0030.00316.96
8.0.250.0030.00317.15
8.0.240.0000.00817.08
8.0.230.0050.00317.09
8.0.220.0070.00017.04
8.0.210.0000.00817.01
8.0.200.0040.00417.14
8.0.190.0040.00417.06
8.0.180.0050.00216.96
8.0.170.0040.00417.04
8.0.160.0000.00717.00
8.0.150.0050.00316.89
8.0.140.0090.00016.96
8.0.130.0030.00313.48
8.0.120.0050.00316.92
8.0.110.0030.00616.98
8.0.100.0040.00417.11
8.0.90.0040.00416.93
8.0.80.0130.00716.96
8.0.70.0040.00416.90
8.0.60.0040.00416.91
8.0.50.0000.00716.98
8.0.30.0110.00817.07
8.0.20.0110.00817.40
8.0.10.0040.00417.11
8.0.00.0110.00916.82
7.4.330.0000.00515.08
7.4.320.0030.00316.64
7.4.300.0000.00616.58
7.4.290.0030.00316.52
7.4.280.0040.00416.62
7.4.270.0000.00716.71
7.4.260.0070.00416.52
7.4.250.0080.00016.69
7.4.240.0050.00216.64
7.4.230.0080.00016.67
7.4.220.0070.01716.62
7.4.210.0120.00616.69
7.4.200.0030.00316.60
7.4.190.0070.00016.70
7.4.160.0090.00916.63
7.4.150.0170.00717.40
7.4.140.0090.01017.86
7.4.130.0060.01116.52
7.4.120.0130.00716.66
7.4.110.0110.00716.59
7.4.100.0120.00616.59
7.4.90.0190.00316.59
7.4.80.0040.01219.39
7.4.70.0080.01116.65
7.4.60.0150.00516.57
7.4.50.0070.00016.62
7.4.40.0060.00922.77
7.4.30.0070.01016.79
7.4.00.0030.01415.07
7.3.330.0020.00213.37
7.3.320.0000.00513.36
7.3.310.0000.00816.34
7.3.300.0020.00516.38
7.3.290.0030.01416.57
7.3.280.0090.00616.47
7.3.270.0060.01017.40
7.3.260.0180.00616.76
7.3.250.0100.00716.52
7.3.240.0060.01216.41
7.3.230.0100.00716.66
7.3.210.0040.01216.38
7.3.200.0070.01319.39
7.3.190.0080.00816.51
7.3.180.0160.00016.51
7.3.170.0060.00916.58
7.3.160.0080.00816.57
7.3.120.0030.01315.10
7.3.10.0100.00316.81
7.3.00.0060.00916.71
7.2.330.0000.01816.49
7.2.320.0090.00916.79
7.2.310.0070.01116.70
7.2.300.0100.00716.53
7.2.290.0100.00616.68
7.2.130.0110.00616.96
7.2.120.0030.00617.03
7.2.110.0000.01316.67
7.2.100.0060.00617.09
7.2.90.0000.01316.73
7.2.80.0090.00616.73
7.2.70.0030.01017.06
7.2.60.0080.00816.94
7.2.50.0070.00717.15
7.2.40.0070.00316.87
7.2.30.0030.00917.12
7.2.20.0030.01316.71
7.2.10.0030.01216.59
7.2.00.0070.00718.36
7.1.250.0070.00715.88
7.1.200.0090.00515.36
7.1.100.0000.01118.32
7.1.70.0040.00417.17
7.1.60.0110.01419.82
7.1.50.0100.01317.02
7.1.00.0070.07322.44
7.0.200.0000.01016.69
7.0.140.0030.07722.08
7.0.60.0070.04019.98
7.0.50.0070.03717.70
7.0.40.0030.04320.12
7.0.30.0270.04320.10
7.0.20.0200.06020.20
7.0.10.0170.04020.01
7.0.00.0130.06720.22
5.6.280.0030.07321.09
5.6.210.0100.08320.66
5.6.200.0030.07718.08
5.6.190.0000.05720.39
5.6.180.0570.05720.78
5.6.170.0330.06320.46
5.6.160.0030.04020.71
5.6.150.0170.04718.18
5.6.140.0170.07018.13
5.6.130.0100.06318.20
5.6.120.0130.07320.90
5.6.110.0070.06320.97
5.6.100.0100.07720.98
5.6.90.0030.09021.03
5.6.80.0130.08020.49
5.5.350.0200.09020.38
5.5.340.0070.03717.95
5.5.330.0100.05320.28
5.5.320.0400.05020.29
5.5.310.0230.05320.26
5.5.300.0030.08317.95
5.5.290.0030.04017.95
5.5.280.0100.04020.68
5.5.270.0070.08720.78
5.5.260.0130.07720.83
5.5.250.0030.08020.57
5.5.240.0230.06720.25
5.4.450.0900.03719.25
5.4.440.0470.05019.56
5.4.430.0730.03719.52
5.4.420.0170.04019.45
5.4.410.1030.03719.27
5.4.400.0800.03719.25
5.4.390.0870.04719.08
5.4.380.0300.05318.70
5.4.370.0600.05018.61
5.4.360.0400.06718.59
5.4.350.0330.05718.64
5.4.340.0330.04318.78
5.4.320.0080.03512.46
5.4.310.0040.04312.45
5.4.300.0090.03712.46
5.4.290.0060.04812.45
5.4.280.0090.04312.35
5.4.270.0060.03512.35
5.4.260.0030.06018.87
5.4.250.0070.08018.82
5.4.240.0100.05318.91
5.4.230.0230.06018.93
5.4.220.0100.05318.93
5.4.210.0030.06018.99
5.4.200.0070.05318.88
5.4.190.0070.05318.93
5.4.180.0170.07018.86
5.4.170.0130.07019.01
5.4.160.0070.06719.00
5.4.150.0170.05318.63
5.4.140.0130.04716.27
5.4.130.0200.06016.27
5.4.120.0170.06716.29
5.4.110.0030.05316.34
5.4.100.0070.05716.40
5.4.90.0100.04316.45
5.4.80.0130.05016.48
5.4.70.0170.06716.41
5.4.60.0200.04316.40
5.4.50.0000.05716.42
5.4.40.0130.06716.25
5.4.30.0130.04716.36
5.4.20.0100.04716.50
5.4.10.0170.04716.49
5.4.00.0130.05015.66
5.3.290.0120.03812.80
5.3.280.0170.06314.60
5.3.270.0130.05014.65
5.3.260.0070.05714.65
5.3.250.0070.05314.77
5.3.240.0130.04714.64
5.3.230.0070.08714.30
5.3.220.0170.04014.57
5.3.210.0030.06714.59
5.3.200.0170.06314.58
5.3.190.0170.04314.27
5.3.180.0230.04014.48
5.3.170.0130.05014.66
5.3.160.0170.05314.71
5.3.150.0100.06014.58
5.3.140.0130.05014.71
5.3.130.0100.05714.55
5.3.120.0100.05014.46
5.3.110.0100.05314.56
5.3.100.0070.05014.06
5.3.90.0030.05314.04
5.3.80.0070.05013.87
5.3.70.0070.05313.96
5.3.60.0170.04314.15
5.3.50.0030.05314.00
5.3.40.0130.04713.83
5.3.30.0100.04713.78
5.3.20.0100.05313.68
5.3.10.0070.04713.59
5.3.00.0030.05013.55
5.2.170.0000.04711.15
5.2.160.0000.04711.30
5.2.150.0130.03311.08
5.2.140.0100.05711.30
5.2.130.0000.06010.95
5.2.120.0130.03711.02
5.2.110.0000.04311.20
5.2.100.0070.03711.11
5.2.90.0030.04011.02
5.2.80.0030.04711.02
5.2.70.0070.04011.11
5.2.60.0130.05011.07
5.2.50.0070.04011.18
5.2.40.0100.04010.77
5.2.30.0100.05010.90
5.2.20.0100.03310.90
5.2.10.0130.03011.04
5.2.00.0100.04310.55
5.1.60.0030.0339.95
5.1.50.0100.04710.24
5.1.40.0070.0339.98
5.1.30.0030.03710.41
5.1.20.0130.03010.19
5.1.10.0070.05310.13
5.1.00.0070.04010.16
5.0.50.0000.0338.65
5.0.40.0100.0308.51
5.0.30.0070.0408.29
5.0.20.0000.0338.25
5.0.10.0030.0408.25
5.0.00.0070.0508.09
4.4.90.0000.0237.00
4.4.80.0070.0177.00
4.4.70.0030.0207.00
4.4.60.0000.0237.00
4.4.50.0030.0207.00
4.4.40.0030.0337.00
4.4.30.0070.0177.00
4.4.20.0030.0237.00
4.4.10.0070.0207.00
4.4.00.0000.0377.00
4.3.110.0100.0207.00
4.3.100.0070.0177.00
4.3.90.0030.0307.00
4.3.80.0000.0337.00
4.3.70.0000.0207.00
4.3.60.0030.0237.00
4.3.50.0030.0207.00
4.3.40.0000.0337.00
4.3.30.0000.0237.00
4.3.20.0030.0237.00
4.3.10.0070.0177.00
4.3.00.0030.01314.49

preferences:
39.84 ms | 401 KiB | 5 Q