PHP- 2 bytes into 1 array
问题 I have printed out this binary which is 8 per line but yet to be stored in an array. <?php // get contents of a file into a string $filename = "rock.wav"; $handle = fopen($filename, "rb"); $contents = fread($handle, filesize($filename)); for($i = 0; $i < strlen($contents); $i++) { $char = $contents[$i]; $str = ord ($char); echo str_pad(decbin($str), 8,"0",STR_PAD_LEFT)."<br/>"; } ?> The outcome is this: 01010010 01001001 01000110 01000110 00000010 it actually has more likely ten thousand line