3v4l.org

run code in 300+ PHP versions simultaneously
<?php $val = 12; $bin_val = 1 << ($val -1); var_dump($bin_val); var_dump(pow(2, $val - 1)); $val = 1 >> ($val - 1); var_dump($val); $binary_string = decbin($bin_val ); // This command test the string with binary values, returning an array with the positions where we have '1'. $positions = StringHelper::strPosAll(strrev($binary_string), '1'); if (is_array($positions)) { // We have to add 1 position to fix the "starts with 0 of arrays". foreach ($positions as $key => $value) { $positions[$key] = ($value + 1); } } else { $positions = array(); } var_dump($positions);
Output for git.master, git.master_jit, rfc.property-hooks
int(2048) int(2048) int(0) Fatal error: Uncaught Error: Class "StringHelper" not found in /in/OqBDj:19 Stack trace: #0 {main} thrown in /in/OqBDj on line 19
Process exited with code 255.

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