- var_dump: documentation ( source)
<?php
$num = 23;
$base = 2;
$stack = new SplStack();
while( $num > 0)
{
$stack->push($num % $base);
$num = (int) ($num/$base); // no integer division
var_dump($num);
}
$stack->rewind();
while( $stack->valid() )
{
echo $stack->current();
$stack->next();
}
echo "\n";