On Thursday 03 February 2005 05:46, Jerry Miller wrote: > Here's the code (with the domain name removed) > that doesn't work, "despite" the poor documentation > of the variable types: > $filename = sprintf ("%s%s", $dir, $file); Wouldn't $filename = $dir . $file; be easier? > printf ("%02x %02x %02x %02x", $cont{0}, $cont{1}, $cont{2}, > $cont{3}); What is happening here is that (as stated in the manual) the format code '%x' will treat the argument ($cont{1}) as an integer and display in hex format. Because $cont{x} is a string, PHP's auto type conversion kicks in. So for example $cont{1} is 'E', coverting to integer makes it 0 (zero), hence what you are seeing. > Here's the output of "od -c glance_date" up to the fourth byte: > > 0000000 177 E L F > > All four bytes are non-zero! What you need is something like: printf ("%02x %02x %02x %02x", ord($cont{0}), ord($cont{1}), ord($cont{2}), ord($cont{3})); Also check out unpack(). -- Jason Wong -> Gremlins Associates -> www.gremlins.biz Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * ------------------------------------------ Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general ------------------------------------------ New Year Resolution: Ignore top posted posts -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php