I’m so new in php. I want to ask for decbin function in PHP
let say I have this code :
<?php
$input= 8;
for($i=0;$i<$input ; $i++){
echo decbin($i)."<br>";
}
?>
then the output will be like this:
0
1
10
11
100
101
110
111
But I want to make the output like this
000
100
100
110
100
101
110
111
Any suggested for this?
You use str_pad
http://sg.php.net/str_pad
Your complete code should look like: