str/Character.php
public static function toBinaryString(string $character) : string
    {
        $result = null;
        $length = strlen($character); // Note: We want the raw length, not the mb length.

        for ($i = 0; $i < $length; ++$i) {
            $result .= sprintf('%08b', ord($character[$i]));
        }

        return $result;
    }
public static function toBinaryString(string $character) : string
    {
        $result = null;
        $length = strlen($character); // Note: We want the raw length, not the mb length.

        for ($i = 0; $i < $length; ++$i) {
            $result .= sprintf('%08b', ord($character[$i]));
        }

        return $result;
    }
public static function toBinaryString ( string $ character ) : string { $ result = null ; $ length = strlen ( $ character ) ; // Note: We want the raw length, not the mb length. for ( $ i = 0 ; $ i < $ length ; ++ $ i ) { $ result .= sprintf ( '%08b' , ord ( $ character [ $ i ] ) ) ; } return $ result ; }
Returns the binary string representation of the given character. Multi-byte safe.

@param   string  $character    The character to represent.
@return  string
Returns the binary string representation of the given character . Multi - byte safe .