note 94810 deleted from function.pack by googleguy

From: Date: Tue, 22 Oct 2013 12:15:27 +0000
Subject: note 94810 deleted from function.pack by googleguy
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-197105@lists.php.net to get a copy of this message
Note Submitter: Anonymous ---- may be useful <?php 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; } ?>

« previous php.notes (#197105) next »