3v4l.org

run code in 300+ PHP versions simultaneously
<?php function distance($vect1, $vect2) { if (!is_array($vect1) || !is_array($vect2)) { return NULL; } if (count($vect1) != count($vect2)) { return NULL; } for ($i=0; $i<count($vect1); $i++) { $c1 = $vect1[$i]; $c2 = $vect2[$i]; $d = 0.0; if (!is_numeric($c1)) { trigger_error("Coordinate $i in vector 1 is not a number, using zero", E_USER_WARNING); $c1 = 0.0; } if (!is_numeric($c2)) { trigger_error("Coordinate $i in vector 2 is not a number, using zero", E_USER_WARNING); $c2 = 0.0; } $d += $c2*$c2 - $c1*$c1; return $d; echo sqrt($d); } return $d; } // variabile non definita, genera un warning $t = I_AM_NOT_DEFINED; // definisce dei vettori $a = array(2, 3, "foo"); $b = array(5.5, 4.3); $c = array(1, 3); // genera un errore utente distance($c, $b) . "\n"; // un'altro errore utente distance($b, "i am not an array") . "\n"; // genera un warning distance($a, $b) . "\n"; ?>
Output for git.master, git.master_jit, rfc.property-hooks
Fatal error: Uncaught Error: Undefined constant "I_AM_NOT_DEFINED" in /in/hMA5o:38 Stack trace: #0 {main} thrown in /in/hMA5o on line 38
Process exited with code 255.

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