这段php代码定义了一个两个数相加的函数,调用后输出函数运行结果。
<html> <head> <title>Writing PHP Function with Parameters</title> </head> <body> <?php function addFunction($num1, $num2) { $sum = $num1 + $num2; echo "Sum of the two numbers is : $sum"; } addFunction(10, 20); ?> </body> </html>
输出结果
Sum of the two numbers is : 30