3v4l.org

run code in 300+ PHP versions simultaneously
<?php $bit1_flag= 1 << 7; $bit2_flag= 1 << 6; // (and i know the fugly for loop should be a do{}while() instead, anyone feel free to fix it, idc) for($i=0;$i<PHP_INT_MAX;++$i){ $str=(string)$i; $hash=hash("sha1",$str,true); $ord=ord($hash[0]); if(($ord & $bit1_flag) || ($ord & $bit2_flag)){ continue; } break; } 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; } var_dump($str,strtobits($hash),bin2hex($hash));
Output for git.master, git.master_jit, rfc.property-hooks
string(1) "1" string(160) "0011010101101010000110010010101101111001000100111011000001001100010101000101011101001101000110001100001010001101010001101110011000111001010101000010100010101011" string(40) "356a192b7913b04c54574d18c28d46e6395428ab"

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:
58.02 ms | 401 KiB | 8 Q