LdapTools\Utilities\MBString::ord PHP Method

ord() public static method

Get the integer value of a specific character.
public static ord ( $string ) : integer
$string
return integer
    public static function ord($string)
    {
        if (self::isMbstringLoaded()) {
            $result = unpack('N', mb_convert_encoding($string, 'UCS-4BE', 'UTF-8'));
            if (is_array($result) === true) {
                return $result[1];
            }
        }
        return ord($string);
    }

Usage Example

 /**
  * Get the full binary representation of the userParameters containing the TSPropertyArray data.
  *
  * @return string
  */
 public function toBinary()
 {
     $binary = hex2bin(str_pad(dechex(MBString::ord($this->signature)), 2, 0, STR_PAD_LEFT));
     $binary .= hex2bin(str_pad(dechex(count($this->tsProperty)), 2, 0, STR_PAD_LEFT));
     foreach ($this->tsProperty as $tsProperty) {
         $binary .= $tsProperty->toBinary();
     }
     return $binary;
 }