3v4l.org

run code in 300+ PHP versions simultaneously
<?php function str2int_mask(string $flags, string $strmask): int { $bitmask = 0; for($i = 0; $i < strlen($strmask); $i++){ if(strpos($flags, $strmask[$i]) === FALSE){ throw new invalidOptionException(); } $bitmask += 2 ** strpos($flags, $strmask[$i]); } return $bitmask; } function int2str_mask(string $flags, int $bitmask): str { $strmask = ''; for($i = 0; $bitmask > 0; $i++){ if($bitmask & 1){ $strmask .= $flags[$i]; } $bitmask = $bitmask >> 1; } return $strmask; } var_dump(str2int_mask('abcd', 'dba'));
Output for git.master, git.master_jit, rfc.property-hooks
int(11)

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:
170.99 ms | 405 KiB | 5 Q