pocketmine\utils\Binary::readLong PHP Méthode

readLong() public static méthode

public static readLong ( $x )
    public static function readLong($x)
    {
        if (PHP_INT_SIZE === 8) {
            $int = unpack("N*", $x);
            return $int[1] << 32 | $int[2];
        } else {
            $value = "0";
            for ($i = 0; $i < 8; $i += 2) {
                $value = bcmul($value, "65536", 0);
                $value = bcadd($value, self::readShort(substr($x, $i, 2)), 0);
            }
            if (bccomp($value, "9223372036854775807") == 1) {
                $value = bcadd($value, "-18446744073709551616");
            }
            return $value;
        }
    }

Usage Example

 public function decode()
 {
     $this->eid = Binary::readLong($this->get(8));
     $this->x = \unpack("N", $this->get(4))[1];
     $this->z = \unpack("N", $this->get(4))[1];
     $this->y = \ord($this->get(1));
 }
All Usage Examples Of pocketmine\utils\Binary::readLong