Hi! Could we please enable some services and cookies to improve your experience and our website?

PHPize Online / SQLize Online  /  SQLtest Online

A A A
Login    Share code      Blog   FAQ

Online Sandbox for SQL and PHP: Write, Run, Test, and Share SQL Queries and PHP Code

Copy Format Clear

Stuck with a problem? Got Error? Ask AI support!

Copy Clear
Copy Format Clear
<?php if ($_SERVER["REQUEST_METHOD"] == "POST") { // 获取用户输入的两个数字并转换类型 $num1 = $_POST['number1']; $num2 = $_POST['number2']; $num1 = 1; $num2 = 3; // 验证输入是否为数字 if (is_numeric($num1) && is_numeric($num2)) { // 计算两个数字的和 $sum = $num1 + $num2; echo "The sum of the two numbers is: ". $sum; } else { echo "Please enter valid numbers."; } } ?>
Copy Clear