public static function convertToBinary($string, $characters) {
        if (empty($string) || empty($characters)) {
            return '';
        }
        $string   = str_split($string);
        $callback = function($str) use ($characters) {
                return strpos($characters, $str);
            };
        $string    = array_map($callback, $string);
        $converted = static::baseConvert($string, strlen($characters), 256);
        $callback  = function ($num) {
                return chr($num);
            };
        return implode('', array_map($callback, $converted));
    }
public static function convertToBinary($string, $characters) {
        if (empty($string) || empty($characters)) {
            return '';
        }
        $string   = str_split($string);
        $callback = function($str) use ($characters) {
                return strpos($characters, $str);
            };
        $string    = array_map($callback, $string);
        $converted = static::baseConvert($string, strlen($characters), 256);
        $callback  = function ($num) {
                return chr($num);
            };
        return implode('', array_map($callback, $converted));
    }
public static function convertToBinary ( $ string , $ characters ) { if ( empty ( $ string ) || empty ( $ characters ) ) { return '' ; } $ string = str_split ( $ string ) ; $ callback = function ( $ str ) use ( $ characters ) { return strpos ( $ characters , $ str ) ; } ; $ string = array_map ( $ callback , $ string ) ; $ converted = static :: baseConvert ( $ string , strlen ( $ characters ) , 256 ) ; $ callback = function ( $ num ) { return chr ( $ num ) ; } ; return implode ( '' , array_map ( $ callback , $ converted ) ) ; }
Convert to a raw binary string from a string of characters

@param string $string     The string to convert from
@param string $characters The list of characters to convert to

@return string The converted string
Convert to a raw binary string from a string of characters