code: public static function ord($char, $encoding = 'UTF-8')
      {
          if (! $char && $char !== '0') {
              return 0;
          }
          if (! isset($char[1])) {
              return ord($char);
          }
          if ($encoding !== 'UCS-4BE') {
              $char = mb_convert_encoding($char, 'UCS-4BE', $encoding);
          }
  
          return unpack('N', $char)[1];
      }
docs: UTF-8 compatible ord()
  
  @param string $char
  @param string $encoding
  
  @return mixed