3v4l.org

run code in 300+ PHP versions simultaneously
<?php $d = distance([2,4], [26,9]); echo 'distance is : ' .$d; function distance( $p1=array(), $p2=array()) { $x1 = $p1[0]; $x2 = $p2[0]; $y1 = $p1[1]; $y2 = $p2[1]; echo "y1 is : $y1\n"; echo "y2 is : $y2\n"; echo "x1 is : $x1\n"; echo "x2 is : $x2\n"; $p1 = ($x1 - $x2); $p2 = ($y1 - $y2); /** $points = [$p1, $p2]; $distance = array_sum($points); $distance = sqrt(($x1 - $x2) + ($y1 - $y2))**2; */ $distance = hypot($p1, $p2); return $distance; }
Output for git.master, git.master_jit, rfc.property-hooks
y1 is : 4 y2 is : 9 x1 is : 2 x2 is : 26 distance is : 24.515301344263

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