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; }
Output for git.master, git.master_jit, rfc.property-hooks
string(1) "�" string(8) "11111111" bool(false) bool(false)

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
97.58 ms | 405 KiB | 5 Q