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 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 (چون هیچ ورودی داده نشده است) ?>
Copy Clear