Hi! Could we please enable some services and cookies to improve your experience and our website?
Online Sandbox for SQL and PHP: Write, Run, Test, and Share SQL Queries and PHP Code
<?php
function myFunction() {
// دریافت تمام آرگومانهای ورودی
$args = func_get_args();
// محاسبه مجموع ورودیها
$total = array_sum($args);
return $total;
}
// استفاده از تابع با ورودیهای مختلف
$result1 = myFunction(1, 2, 3);
echo $result1; // خروجی: 6
$result2 = myFunction(10, 20, 30, 40);
echo $result2; // خروجی: 100
$result3 = myFunction();
echo $result3; // خروجی: 0 (چون هیچ ورودی داده نشده است)
?>