3v4l.org

run code in 300+ PHP versions simultaneously
<?php function roundup_pow2(int $v, int $p2): int { $p2 = 2 ** $p2 - 1; return ($v + $p2) & ~$p2; } /* examples: round up to the multiple of 32 (2^5) */ echo roundup_pow2(31, 5), PHP_EOL; echo roundup_pow2(32, 5), PHP_EOL; echo roundup_pow2(33, 5), PHP_EOL; /* and here's how you align your strings using it */ $test = "12345"; /* let's align this to 4 chars boundary */ echo str_pad($test, roundup_pow2(strlen($test), 2), "0", STR_PAD_LEFT), PHP_EOL;

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.0090.00916.75
8.3.50.0070.00718.00
8.3.40.0050.01018.64
8.3.30.0120.00618.71
8.3.20.0090.00620.20
8.3.10.0080.00023.61
8.3.00.0070.01023.48
8.2.180.0150.00325.92
8.2.170.0070.00722.96
8.2.160.0040.01120.35
8.2.150.0050.00224.18
8.2.140.0040.00424.66
8.2.130.0070.00026.16
8.2.120.0040.00421.13
8.2.110.0060.00322.11
8.2.100.0080.00319.75
8.2.90.0090.00017.88
8.2.80.0040.00420.69
8.2.70.0070.00517.00
8.2.60.0000.01017.75
8.2.50.0000.00817.63
8.2.40.0000.00817.62
8.2.30.0050.00319.15
8.2.20.0030.00517.98
8.2.10.0070.00018.17
8.2.00.0000.00718.00
8.1.280.0130.01325.92
8.1.270.0050.00324.01
8.1.260.0040.00426.35
8.1.250.0080.00028.09
8.1.240.0030.00723.78
8.1.230.0060.00619.00
8.1.220.0050.00317.74
8.1.210.0000.00918.77
8.1.200.0090.00017.22
8.1.190.0070.00317.22
8.1.180.0060.00618.10
8.1.170.0040.00419.13
8.1.160.0000.00718.89
8.1.150.0030.00320.14
8.1.140.0040.00417.44
8.1.130.0000.00718.74
8.1.120.0000.00717.39
8.1.110.0000.00917.31
8.1.100.0070.00017.40
8.1.90.0000.00817.38
8.1.80.0000.00717.46
8.1.70.0050.00317.29
8.1.60.0030.00517.62
8.1.50.0040.00417.49
8.1.40.0030.00517.41
8.1.30.0000.00817.55
8.1.20.0040.00417.69
8.1.10.0000.00817.57
8.1.00.0000.00717.58
8.0.300.0000.00818.77
8.0.290.0050.00516.75
8.0.280.0070.00018.32
8.0.270.0050.00317.21
8.0.260.0030.00616.79
8.0.250.0030.00316.84
8.0.240.0060.00316.95
8.0.230.0040.00416.89
8.0.220.0030.00316.77
8.0.210.0070.00016.96
8.0.200.0000.00716.95
8.0.190.0040.00417.02
8.0.180.0050.00316.92
8.0.170.0020.00516.83
8.0.160.0000.00816.80
8.0.150.0040.00416.82
8.0.140.0000.00816.70
8.0.130.0060.00013.34
8.0.120.0050.00316.70
8.0.110.0050.00216.83
8.0.100.0040.00416.84
8.0.90.0000.00716.74
8.0.80.0070.01116.83
8.0.70.0070.00016.72
8.0.60.0040.00416.66
8.0.50.0040.00416.69
8.0.30.0070.01017.18
8.0.20.0090.01117.40
8.0.10.0000.00816.95
8.0.00.0150.00816.79
7.4.330.0000.00416.89
7.4.320.0030.00316.60
7.4.300.0000.00616.54
7.4.290.0000.00716.38
7.4.280.0000.00816.59
7.4.270.0040.00416.47
7.4.260.0000.00816.60
7.4.250.0040.00416.53
7.4.240.0040.00316.53
7.4.230.0000.00716.51
7.4.220.0090.01616.36
7.4.210.0090.00616.63
7.4.200.0030.00316.45
7.4.160.0070.00916.50
7.4.150.0120.00617.40
7.4.140.0130.00517.86
7.4.130.0130.00916.71
7.4.120.0120.00916.56
7.4.110.0060.01216.47
7.4.100.0100.01016.67
7.4.90.0150.00316.47
7.4.80.0080.01419.39
7.4.70.0030.01416.64
7.4.60.0060.01016.40
7.4.50.0130.00316.42
7.4.40.0060.00916.65
7.4.30.0120.00316.54
7.4.00.0030.00914.89
7.3.330.0000.00513.37
7.3.320.0030.00313.18
7.3.310.0000.00716.24
7.3.300.0070.00016.25
7.3.290.0110.00616.33
7.3.280.0090.00816.37
7.3.270.0100.00717.40
7.3.260.0100.00716.41
7.3.250.0110.00716.52
7.3.240.0080.00916.31
7.3.230.0100.00616.62
7.3.210.0160.00016.56
7.3.200.0130.00316.51
7.3.190.0090.00616.57
7.3.180.0110.00616.40
7.3.170.0030.01216.52
7.3.160.0060.01016.66
7.2.330.0090.00916.45
7.2.320.0120.00916.44
7.2.310.0090.00916.71
7.2.300.0090.00916.64
7.2.290.0080.00816.55
7.2.60.0000.01417.06
7.1.200.0120.00415.51
7.1.110.0720.01316.08
7.1.100.0210.00915.96
7.1.90.0120.00816.00
7.1.80.0190.00916.30
7.1.70.0150.00715.11
7.1.60.0230.00633.32
7.1.50.0130.01732.87
7.1.40.0220.01932.67
7.1.30.0170.01532.62
7.1.20.0190.01332.81
7.1.10.0140.00714.73
7.1.00.0090.00914.91
7.0.250.0730.00715.88
7.0.240.0390.00715.84
7.0.230.0190.00515.96
7.0.220.6540.01015.76
7.0.210.0090.01314.80
7.0.200.0100.00515.10
7.0.190.0130.01314.65
7.0.180.0100.01314.42
7.0.170.0130.00314.62
7.0.160.0090.00914.40
7.0.150.0300.01414.54
7.0.140.0090.00614.62
7.0.130.0100.01314.95
7.0.120.0130.01014.87
7.0.110.0060.01114.49
7.0.100.0170.01014.46
7.0.90.0080.00814.61
7.0.80.0060.00914.64
7.0.70.0090.00614.58
7.0.60.0220.00914.45
7.0.50.0190.00314.48
7.0.40.0110.01114.70
7.0.30.0090.01214.62
7.0.20.5120.00714.66
7.0.10.0300.01314.56
7.0.00.0560.01314.67

preferences:
33.96 ms | 401 KiB | 5 Q