3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $weight = $_POST["txtWeight"]; $height = $_POST["txtHeight"]; $unit = $_POST["optUnit"]; $message = ""; if($unit == "metric") { $bmiCalc = $weight/($height*$height); #This Line $message = "Metric BMI: $bmiCalc"; } else { $bmiCalc = ($weight * 703)/($height * $height); $message = "Imperial BMI: $bmiCalc"; }
Output for 5.3.0 - 7.1.0
Notice: Undefined index: txtWeight in /in/2CGfa on line 4 Notice: Undefined index: txtHeight in /in/2CGfa on line 5 Notice: Undefined index: optUnit in /in/2CGfa on line 6 Warning: Division by zero in /in/2CGfa on line 16
Output for 4.3.0 - 5.2.17
Notice: Undefined index: txtWeight in /in/2CGfa on line 4 Notice: Undefined index: txtHeight in /in/2CGfa on line 5 Notice: Undefined index: optUnit in /in/2CGfa on line 6 Warning: Division by zero in /in/2CGfa on line 16