note 80268 added to function.pack
| From: | ron656 at gmail dot com | Date: | Mon, 07 Jan 2008 13:47:18 +0000 |
| Subject: | note 80268 added to function.pack | ||
| Groups: | php.notes php.notes | ||
| Request: | Send a blank email to php-notes+get-134921@lists.php.net to get a copy of this message | ||
I was playing around with pack function.
[code]
$dom = "Ursa-Minor";
$dom_len = strlen($dom); //10
$dom_len_hex = pack("s",$dom_len); //0A00
print $dom_len_hex;
[/code]
Expected this to give 0A 00 but ended up with 0D 0A 00
There is a CR ^M in front of the result.
Did the same with $dom = "Ursaa-Minor" and $dom = "Urs-Minor". Which gave me the
expeced result 0B 00 and 09 00
Can someone explain why 0A 00 is orefixed with 0D (CR ^M)
greetz,
Ron
----
Server IP: 69.147.83.197
Probable Submitter: 145.119.165.101
----
Manual Page -- http://www.php.net/manual/en/function.pack.php
Edit -- https://master.php.net/note/edit/80268
Del: integrated -- https://master.php.net/note/delete/80268/integrated
Del: useless -- https://master.php.net/note/delete/80268/useless
Del: bad code -- https://master.php.net/note/delete/80268/bad+code
Del: spam -- https://master.php.net/note/delete/80268/spam
Del: non-english -- https://master.php.net/note/delete/80268/non-english
Del: in docs -- https://master.php.net/note/delete/80268/in+docs
Del: other reasons-- https://master.php.net/note/delete/80268
Reject -- https://master.php.net/note/reject/80268
Search -- https://master.php.net/manage/user-notes.php