3v4l.org

run code in 300+ PHP versions simultaneously
<?php const INT_SIGNED = 1; const INT_LE = 2; function isLittleEndian() { return pack('S', 0x00FF) === "\xFF\x00"; } function is32Bit() { return PHP_INT_MAX < 0x80000000; } function unpack_int32($str, $flags = 0) { $length = strlen($str); if ($length < 4) { return false; } else if ($length > 4) { $str = substr($str, 0, 4); } $format = ($flags & INT_LE) ? 'V' : 'N'; $result = current(unpack($format, $str)); if (($result & 0x80000000) && ($flags & INT_SIGNED) && !is32Bit()) { $result = 0xFFFFFFFF00000000 | $result; } return $result; } var_dump(isLittleEndian(), is32Bit(), unpack_int32("\xFF\xFF\xFE\xFF", INT_SIGNED | INT_LE));
Output for git.master, git.master_jit, rfc.property-hooks
Deprecated: Implicit conversion from float 1.8446744069414584E+19 to int loses precision in /in/sODBB on line 25 bool(true) bool(false) int(-65537)

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
33.79 ms | 401 KiB | 8 Q