- array_push: documentation ( source)
- array_pop: documentation ( source)
<?php
$num = 11;
while( $num > 0) {
array_push($stack,($num % $base)); // pushes remainder on stack
$num = (int) ($num/$base); // no integer division
}
while($stack) {
echo array_pop($stack); // 1011 in final iteration
}
echo "\n";