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

writeLong() public static méthode

public static writeLong ( $value )
    public static function writeLong($value)
    {
        if (PHP_INT_SIZE === 8) {
            return pack("NN", $value >> 32, $value & 0xffffffff);
        } else {
            $x = "";
            if (bccomp($value, "0") == -1) {
                $value = bcadd($value, "18446744073709551616");
            }
            $x .= self::writeShort(bcmod(bcdiv($value, "281474976710656"), "65536"));
            $x .= self::writeShort(bcmod(bcdiv($value, "4294967296"), "65536"));
            $x .= self::writeShort(bcmod(bcdiv($value, "65536"), "65536"));
            $x .= self::writeShort(bcmod($value, "65536"));
            return $x;
        }
    }

Usage Example

 public function encode()
 {
     $this->reset();
     $this->buffer .= Binary::writeLong($this->from);
     $this->buffer .= Binary::writeLong($this->to);
     $this->buffer .= \chr($this->type);
 }
All Usage Examples Of pocketmine\utils\Binary::writeLong