Invalid hex returned from dechex();



Hello,

I'm trying to find a valid hex notation return that consists of 2, 4,
6, 8... digits of hexadecimal, numbers, simply from a loop.

<?php

for ($i = '0'; $i <= '10000'; $i++) {
echo dechex($i) . "\n";
}

?>

This should return valid hex notation, however, this is the return...

0
1
2
3
4
5
6
7
8
9
a
b
c
d
e
f
10
11
12
....
100
101
102
....

Can anyone point a proper procedure for returning a valid notion for
hex, for such a simple task, and why the php developers are sitting on
their a** about this one.

Source: http://en.wikipedia.org/wiki/Hexadecimal

Thankyou.

.



Relevant Pages

  • Re: why doesnt this work
    ... positive number in a for loop, ... echo 'foo'; ... Someone with an equal problem some weeks ago turned out to have something like '12' instead of '12', which will be interpreted as 0 when cast to an integer, but seems OK when just echo'ed & viewed in a browser. ...
    (comp.lang.php)
  • Re: rewritting a short ASP script to PHP
    ... Iván Sánchez Ortega wrote: ... echo ''; ... It looks sooooo much nicer in PHP:) ...
    (comp.lang.php)
  • Re: date_format
    ... wordpress datebase in a while loop. ... by using the datefunction of php. ... echo date); ...
    (comp.lang.php)
  • Re: Echo in Echo
    ... while" loop? ... You appear to be using $row_getObjectTypes in the echo before assigning it with mysql_fetch_assoc. ... you need to check beforehand so you can prevent an empty select input? ...
    (comp.lang.php)
  • Evaluating Strings...
    ... In php, I have an array called "q". ... I'd like to be able to loop through this array via a While loop, ... echo the contents of these array elements back to the screen. ...
    (comp.lang.php)