note 94810 added to function.pack
| From: | Anonymous at osu1 dot php dot net | Date: | Thu, 26 Nov 2009 01:18:27 +0000 |
| Subject: | note 94810 added to function.pack | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-163294@lists.php.net to get a copy of this message | ||
may be useful
public function unpack_str($str, $len) {
$tmp_arr = unpack("c".$len."chars", $str);
$out_str = "";
foreach($tmp_arr as $v) {
if($v>0) {
$out_str .= chr($v);
}
}
return $out_str;
}
public function pack_str($str, $len) {
$out_str = "";
for($i=0; $i<$len; $i++) {
$out_str .= pack("c", ord(substr($str, $i, 1)));
}
return $out_str;
}
----
Server IP: 93.93.89.253
Probable Submitter: 78.153.156.157
----
Manual Page -- http://www.php.net/manual/en/function.pack.php
Edit -- https://master.php.net/note/edit/94810
Del: integrated -- https://master.php.net/note/delete/94810/integrated
Del: useless -- https://master.php.net/note/delete/94810/useless
Del: bad code -- https://master.php.net/note/delete/94810/bad+code
Del: spam -- https://master.php.net/note/delete/94810/spam
Del: non-english -- https://master.php.net/note/delete/94810/non-english
Del: in docs -- https://master.php.net/note/delete/94810/in+docs
Del: other reasons-- https://master.php.net/note/delete/94810
Reject -- https://master.php.net/note/reject/94810
Search -- https://master.php.net/manage/user-notes.php