3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php class Calc{ var $number1; var $number2; public function add($number1, $number2){ $add = $number1 + $number2; return $add; } public function mult($number1, $number2){ $mult = $number1 * $number2; return $mult; } public function sub($number1, $number2){ $sub = $number1 - $number2; return $sub; } public function div($number1, $number2){ $div = $number1 / $number2; return $div; } } if (isset($_POST['formNumber1']) && isset($_POST['formNumber2'])) { $calc = new Calc; echo $calc->add($_POST['formNumber1'], $_POST['formNumber2']); } ?> <form action="Calculator1.php" method="post"> <input type="text" name="formNumber1" maxlength='100' /> <input type="text" name="formNumber2" maxlength='100' /> <input type="submit" name="formSubmit" value="Submit" /> </form>
Output for 5.1.3 - 7.1.0
<form action="Calculator1.php" method="post"> <input type="text" name="formNumber1" maxlength='100' /> <input type="text" name="formNumber2" maxlength='100' /> <input type="submit" name="formSubmit" value="Submit" /> </form>
Output for 5.0.0 - 5.1.2
Strict Standards: var: Deprecated. Please use the public/private/protected modifiers in /in/8hB2j on line 3 Strict Standards: var: Deprecated. Please use the public/private/protected modifiers in /in/8hB2j on line 4 <form action="Calculator1.php" method="post"> <input type="text" name="formNumber1" maxlength='100' /> <input type="text" name="formNumber2" maxlength='100' /> <input type="submit" name="formSubmit" value="Submit" /> </form>
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/8hB2j on line 6
Process exited with code 255.
Output for 4.3.1, 4.3.5 - 4.4.1
Parse error: parse error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/8hB2j on line 6
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error, expecting `T_OLD_FUNCTION' or `T_FUNCTION' or `T_VAR' or `'}'' in /in/8hB2j on line 6
Process exited with code 255.
Output for 4.3.0
Parse error: parse error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/2jvMK on line 6
Process exited with code 255.