| Conditions | 2 |
| Paths | 2 |
| Total Lines | 10 |
| Code Lines | 7 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 17 | function str2bin($str) |
||
| 18 | { |
||
| 19 | $out=null; |
||
| 20 | $strLength = \strlen($str); |
||
| 21 | for($a=0; $a < $strLength; $a++) { |
||
| 22 | $dec = \ord(substr($str,$a,1)); //determine symbol ASCII-code |
||
| 23 | $bin = sprintf('%08d', base_convert($dec, 10, 2)); //convert to binary representation and add leading zeros |
||
| 24 | $out .= $bin; |
||
| 25 | } |
||
| 26 | return $out; |
||
| 27 | } |
||
| 28 |