note 61464 added to function.decbin

From: Date: Sat, 04 Feb 2006 10:57:38 +0000
Subject: note 61464 added to function.decbin
Groups: php.notes 
Request: Send a blank email to php-notes+get-102978@lists.php.net to get a copy of this message
A fast function to convert a binary string to a bit sequence <?php function BinString2BitSequence($mystring) { $mybitseq = ""; $end = strlen($mystring); for($i = 0 ; $i < $end; $i++){ $mybyte = decbin(ord($mystring[$i])); // convert char to bit string $mybitseq .= substr("00000000",0,8 - strlen($mybyte)) . $mybyte; // 8 bit packed } return $mybitseq; } echo BinString2BitSequence("ABCDEF"); // OUTPUT=010000010100001001000011010001000100010101000110 ?> ---- Server IP: 195.221.21.36 Probable Submitter: 82.227.179.157 ---- Manual Page -- http://www.php.net/manual/en/function.decbin.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+61464 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+61464&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+61464&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+61464&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+61464&report=yes&reason=useless Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+61464&report=yes&reason=non-english Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+61464&report=yes&reason=already+in+docs Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+61464&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+61464&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#102978) next »