note 86398 added to function.pack
| From: | qwanta at osu1 dot php dot net | Date: | Thu, 16 Oct 2008 14:28:41 +0000 |
| Subject: | note 86398 added to function.pack | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-145429@lists.php.net to get a copy of this message | ||
Unlike the PERL pack function, the PHP version does not accept arrays as arguments (see PHP Bugs:
#5889).
To get around this I found something like this works:
<?php
$word_data = array(132,457,234,63);
$packet_send = "";
foreach ($word_data as $word) {
$packet_send = $packet_send.pack("v",$word);
}
?>
As Pack returns a string, so you can just concatenate them.
----
Server IP: 208.69.120.35
Probable Submitter: 69.198.117.98
----
Manual Page -- http://www.php.net/manual/en/function.pack.php
Edit -- https://master.php.net/note/edit/86398
Del: integrated -- https://master.php.net/note/delete/86398/integrated
Del: useless -- https://master.php.net/note/delete/86398/useless
Del: bad code -- https://master.php.net/note/delete/86398/bad+code
Del: spam -- https://master.php.net/note/delete/86398/spam
Del: non-english -- https://master.php.net/note/delete/86398/non-english
Del: in docs -- https://master.php.net/note/delete/86398/in+docs
Del: other reasons-- https://master.php.net/note/delete/86398
Reject -- https://master.php.net/note/reject/86398
Search -- https://master.php.net/manage/user-notes.php