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 5.2.0 - 5.2.17, 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 5.5.0 - 5.5.38, 5.6.0 - 5.6.40, 7.0.0 - 7.0.33, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
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" }
Output for 5.1.0 - 5.1.6
<br /> <b>Fatal error</b>: Call to undefined function error_get_last() in <b>/in/hteZr</b> on line <b>18</b><br />
Process exited with code 255.
Output for 5.0.0 - 5.0.5
<br /> <b>Fatal error</b>: Call to undefined function inet_ntop() in <b>/in/hteZr</b> on line <b>12</b><br />
Process exited with code 255.
Output for 4.4.5 - 4.4.9
<br /> <b>Fatal error</b>: Call to undefined function: inet_ntop() in <b>/in/hteZr</b> on line <b>12</b><br />
Process exited with code 255.
Output for 4.3.2 - 4.3.11, 4.4.0 - 4.4.4
<br /> <b>Fatal error</b>: Call to undefined function: inet_ntop() in <b>/in/hteZr</b> on line <b>12</b><br />
Process exited with code 255.
Output for 4.3.0 - 4.3.1
<br /> <b>Fatal error</b>: Call to undefined function: inet_ntop() in <b>/in/hteZr</b> on line <b>12</b><br />

preferences:
333.18 ms | 401 KiB | 460 Q