Skip to content

Instantly share code, notes, and snippets.

@d30jeff
Last active January 21, 2017 14:48
Show Gist options
  • Save d30jeff/197d6e7612a69bc08ca055443979fd1e to your computer and use it in GitHub Desktop.
Save d30jeff/197d6e7612a69bc08ca055443979fd1e to your computer and use it in GitHub Desktop.
256 128 etc
<?php
$number = 256;
$arr = [];
while($number > 0) {
$arr[] = $number;
$number = $number >> 1;
}
foreach (array_chunk($arr, 3) as $num) {
echo "{$num[0]} | {$num[1]} | {$num[2]} \n";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment