3v4l.org

run code in 300+ PHP versions simultaneously
<?php function mask(int $bits, int $ones): string { $m = ""; for ($i = 0; $i < $bits/8; $i++) { if ($ones >= 8) { $m .= chr(0xff); $ones -= 8; } else { $m .= chr(~(0xff>>$ones)); $ones = 0; } } return $m; } $addr = inet_pton("d7a:5949:11d0:bd9e:b2c1:6268:d889:de9b"); $mask = mask(128, 48); $start = ""; for ($i = 0; $i < strlen($addr); $i++) { $start .= $addr[$i] & $mask[$i]; } echo inet_ntop($start), "\n";
Output for git.master_jit, git.master, rfc.property-hooks
d7a:5949:11d0::

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:
140.25 ms | 405 KiB | 5 Q