But I think he'll still have an issue when he goes to transmit it. Whatever data you have is going to be interpreted by the function doing the sending unless it's a "binary safe" function that's going to send raw binary.
Thanks for the tip on "pack" though. Havn't needed it yet, but always good to know. And PHP has so many functions (I'm constantly amazed that it usually has a function for whatever I need). -TG > -----Original Message----- > From: DvDmanDT [mailto:[EMAIL PROTECTED] > Sent: Thursday, January 29, 2004 6:58 PM > To: [EMAIL PROTECTED] > Subject: Re: [PHP] sending a hex string as it is? > > > No need to ge that deep (socket_create and stuff).. > To send the HEX number 20 (also a space), you can do the following: > > "\x20"; > chr(0x20); > chr(hexdec('20')); > pack('C',0x20); > > All of those _should_ create a space... > -- > // DvDmanDT > MSN: dvdmandt€hotmail.com > Mail: dvdmandt€telia.com > "Trevor Gryffyn" <[EMAIL PROTECTED]> skrev i meddelandet > news:[EMAIL PROTECTED] > RCARGO.COM... > Ahh.. Since you're not declaring what data type $var is, it must be > treating it as a string, even though I'd think it'd take it > as an int if > you didn't put quotes around it. That's one thing I like about PHP.. > You can be as strict or lax as you want with the types. But I can see > in this case where it'd cause an issue. > > Well, you could try: > > Intval($var) > > That should force it to be an integer. > > > You know what, I think the real question here is how are you > "sending it > over the wire". Sounds like you're sending it in some manner that > transmits it as text. In which case you WILL get "32 30" for a "20".. > And if you convert the 20 to an INT, you'll still get it > because of the > way you're transmitting. > > You're probably going to have to open a binary connection to whatever > you're doing. > > Look into "socket_create()" > > Sounds like you need something a little more low-level than > what you're > using. > > -TG > > > -----Original Message----- > > From: Khoa Nguyen [mailto:[EMAIL PROTECTED] > > Sent: Thursday, January 29, 2004 8:51 AM > > To: David OBrien; [EMAIL PROTECTED] > > Subject: RE: [PHP] sending a hex string as it is? > > > > > > I guess I confused the matter by mentioning hex. The problem > > is the same > > with decimal number; for example > > <?php > > $var = 20; > > echo $var; // This will send 32 30 over the wire, not 14 (hex > > value of decimal 20) > > // How do I make it send 14? > > ?> > > > > I guess "echo" function treats $var as a string. Maybe I am > > looking for > > a function that will sends a data stream as it is > > > > Thanks, > > Khoa > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php