3v4l.org

run code in 300+ PHP versions simultaneously
<?php $str = chr(255); var_dump( $str, strtobits($str), mb_check_encoding($str, '7bit'), is_7bit_clean($str) ); function is_7bit_clean(string $str):bool{ for($i=0,$imax=strlen($str);$i<$imax;++$i){ if(ord($str[$i]) & (1 << 7)){ return false; } } return true; } function strtobits(string $str): string { $ret = ""; for ($i = 0; $i < strlen($str); ++ $i) { $ord = ord($str[$i]); for ($bitnum = 7; $bitnum >= 0; -- $bitnum) { if ($ord & (1 << $bitnum)) { $ret .= "1"; } else { $ret .= "0"; } } } return $ret; }

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.4.120.0080.01120.61
8.4.110.0150.00522.45
8.4.100.0130.01217.50
8.4.90.0130.00718.51
8.4.80.0120.00717.95
8.4.70.0130.01017.75
8.4.60.0120.00718.78
8.4.50.0040.00518.77
8.4.40.0100.01019.19
8.4.30.0090.00920.46
8.4.20.0130.00619.71
8.4.10.0000.00817.63
8.3.250.0060.00218.97
8.3.240.0120.00616.45
8.3.230.0100.00516.76
8.3.220.0090.00619.02
8.3.210.0130.00616.54
8.3.200.0090.00016.62
8.3.190.0100.00917.21
8.3.180.0050.00416.75
8.3.170.0140.00420.50
8.3.160.0030.00618.38
8.3.150.0130.00616.86
8.3.140.0000.00818.95
8.3.130.0090.00018.29
8.3.120.0060.01219.08
8.3.110.0120.00620.94
8.3.100.0040.00424.06
8.3.90.0110.00426.77
8.3.80.0040.00716.41
8.3.70.0120.00616.73
8.3.60.0070.00716.50
8.3.50.0000.01520.09
8.3.40.0140.00719.04
8.3.30.0090.00619.04
8.3.20.0070.00024.18
8.3.10.0000.00824.66
8.3.00.0000.00826.16
8.2.290.0120.00720.43
8.2.280.0100.00818.47
8.2.270.0130.00619.11
8.2.260.0030.00616.50
8.2.250.0080.00016.62
8.2.240.0090.00618.71
8.2.230.0110.00422.58
8.2.220.0030.00637.54
8.2.210.0070.00726.77
8.2.200.0060.00316.38
8.2.190.0040.01116.63
8.2.180.0140.00725.92
8.2.170.0030.01022.96
8.2.160.0070.00722.96
8.2.150.0080.00025.66
8.2.140.0080.00024.66
8.2.130.0000.00726.16
8.2.120.0040.00426.16
8.2.110.0040.00722.07
8.2.100.0040.00817.84
8.2.90.0040.00419.05
8.2.80.0060.00317.97
8.2.70.0000.01017.50
8.2.60.0060.00617.80
8.2.50.0030.00518.07
8.2.40.0080.00018.34
8.2.30.0000.00718.11
8.2.20.0050.00220.44
8.2.10.0000.00817.71
8.2.00.0000.00719.18
8.1.330.0090.00821.67
8.1.320.0150.00816.07
8.1.310.0000.00818.28
8.1.300.0060.01018.45
8.1.290.0060.00318.88
8.1.280.0130.00725.92
8.1.270.0030.00623.74
8.1.260.0040.00426.35
8.1.250.0050.00328.09
8.1.240.0100.00723.87
8.1.230.0040.00722.17
8.1.220.0000.00917.74
8.1.210.0080.00018.77
8.1.200.0070.00317.23
8.1.190.0050.00317.10
8.1.180.0060.00318.10
8.1.170.0040.00418.46
8.1.160.0070.00018.76
8.1.150.0080.00018.45
8.1.140.0050.00517.30
8.1.130.0000.00718.84
8.1.120.0000.01017.37
8.1.110.0050.00317.43
8.1.100.0000.00717.30
8.1.90.0070.00017.41
8.1.80.0060.00616.96
8.1.70.0000.00717.44
8.1.60.0060.00317.62
8.1.50.0000.00717.52
8.1.40.0000.00817.55
8.1.30.0150.00917.59
8.1.20.0210.00417.66
8.1.10.0200.00517.60
8.1.00.0180.00617.58
8.0.300.0030.00818.77
8.0.290.0040.00416.75
8.0.280.0000.00918.45
8.0.270.0040.00418.01
8.0.260.0000.00618.35
8.0.250.0040.00416.93
8.0.240.0040.00717.00
8.0.230.0050.00417.00
8.0.220.0030.00316.81
8.0.210.0040.00416.79
8.0.200.0000.00616.95
8.0.190.0070.00016.94
8.0.180.0040.00416.81
8.0.170.0040.00716.95
8.0.160.0190.00316.89
8.0.150.0180.00016.88
8.0.140.0180.00016.87
8.0.130.0120.00616.80
8.0.120.0130.00716.86
8.0.110.0170.00316.98
8.0.100.0190.00016.82
8.0.90.0080.00816.91
8.0.80.0140.00416.89
8.0.70.0190.00316.88
8.0.60.0150.00416.92
8.0.50.0100.01016.84
8.0.30.0140.00716.71
8.0.20.0130.00816.84
8.0.10.0150.00616.83
7.4.330.0000.00515.55
7.4.320.0070.00016.55
7.4.300.0030.00316.52
7.4.290.0030.00516.54
7.4.280.0060.00616.57
7.4.270.0190.00516.47
7.4.260.0210.00016.57
7.4.250.0220.00316.35
7.4.240.0170.00816.50
7.4.230.0170.00616.50
7.4.220.0150.00416.43
7.4.210.0160.00516.52
7.4.200.0130.00616.57
7.4.190.0180.00016.54
7.4.180.0130.00716.56
7.4.160.0180.00416.60
7.4.150.0200.00016.51
7.4.140.0140.00616.58
7.4.130.0140.00416.37
7.4.120.0170.00416.42
7.4.110.0110.00716.51
7.4.100.0000.00716.61
7.4.90.0030.00316.61
7.4.80.0070.00016.36
7.4.70.0000.00816.43
7.4.60.0040.00416.43
7.4.50.0000.00716.53
7.4.40.0050.00216.43
7.4.30.0080.00416.50
7.4.20.0090.00316.63
7.4.10.0080.00416.48
7.4.00.0100.00316.45

preferences:
32.04 ms | 403 KiB | 5 Q