3v4l.org

run code in 300+ PHP versions simultaneously
<?php error_reporting(E_ALL); function ip6ptrtoip6($arpa) { $mainptr = substr($arpa, 0, strlen($arpa)-9); $pieces = array_reverse(explode(".",$mainptr)); $count=count($pieces); $hex = implode("",$pieces); $hex=str_pad($hex,32,'0'); $ipbin = pack('H*', $hex); $ipv6addr = inet_ntop($ipbin); if($count<32) { $ipv6addr .= '0/' . $count*4; } // dump_nice essentially captures the output of var_dump into a string so I can // at the bottom of the page. var_dump(array($arpa,$hex,error_get_last(),$ipv6addr)); return $ipv6addr; } ip6ptrtoip6("0.7.1.2.2.0.a.2.ip6.arpa");
Output for git.master, git.master_jit, rfc.property-hooks
array(4) { [0]=> string(24) "0.7.1.2.2.0.a.2.ip6.arpa" [1]=> string(32) "2a022170000000000000000000000000" [2]=> NULL [3]=> string(15) "2a02:2170::0/32" }

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:
45.66 ms | 401 KiB | 8 Q