composer require thesis/endian- In
network(big endian) byte order.
use Thesis\Endian;
echo Endian\Order::network->unpackInt32(
Endian\Order::network->packInt32(-200),
); // -200- In
big endianbyte order.
use Thesis\Endian;
echo Endian\Order::big->unpackInt8(
Endian\Order::big->packInt8(17),
); // 17- In
little endianbyte order.
use Thesis\Endian;
echo Endian\Order::little->unpackFloat(
Endian\Order::little->packFloat(2.2),
); // 2.2- In
native endianbyte order.
use Thesis\Endian;
use BcMath\Number;
echo Endian\Order::native()
->unpackInt64(
Endian\Order::native()->packInt64(new Number('9223372036854775807')),
)
->value; // 9223372036854775807-
int8 -
uint8 -
int16 -
uint16 -
int32 -
uint32 -
int64 -
uint64 -
float -
double