On Thursday 21 November 2002 15:51, Chris Wesley wrote: > Using PHP/4.2.2 & Apache/1.3.26 on Linux 2.4.17 > > I'm trying to format a HEX value into an 8-byte string, that is > zero-padded to the left, using sprintf(). Simple enough. > > $sprintf( "%08x", "fa23d" ); > This should return "000fa23d". But it returns "00000000".
That's because it's expecting a _decimal_ and will automatically convert it to hex for you. Try: echo $sprintf( "%08x", "1024573" ); -- Jason Wong -> Gremlins Associates -> www.gremlins.biz Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * /* "All Bibles are man-made." -- Thomas Edison */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php