3v4l.org

run code in 300+ PHP versions simultaneously
<?php echo PHP_INT_SIZE . "\n"; function pickBitsFromInput($val, $amtBits, $arraySize) { $itrs = ceil($amtBits / 8); $results = []; $ret = []; for ($i = 0; $i < $itrs; $i++) { $val = hash('sha256', $val, true); $results = array_merge($results, unpack('L8', $val)); } for ($i = 0; $i < $amtBits; $i++) { $ret[] = $results[$i] % $arraySize; } return $ret; } var_dump(pickBitsFromInput('woohoo', 9, 1000000));
Output for git.master, git.master_jit, rfc.property-hooks
8 array(9) { [0]=> int(909622) [1]=> int(769468) [2]=> int(351656) [3]=> int(627807) [4]=> int(415545) [5]=> int(633584) [6]=> int(421488) [7]=> int(151217) [8]=> int(321995) }

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