Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
PHP - pass by reference & a function that accepts an unspecified number of parameters.
<?php //php 7.0.8 function sum(&$sum,&$product,&$min,&$max) { $sum=0; $product=1; $min=$max=func_get_args()[4]; for ($i=4;$i<func_num_args();$i++) { $sum += func_get_args()[$i]; $product *= func_get_args()[$i]; if (func_get_args()[$i]>$max) { $max=func_get_args()[$i]; } else if (func_get_args()[$i]<$min) { $min=func_get_args()[$i]; } } } $a; $b; $c; $d; sum($a,$b,$c,$d,2,4,7); echo "the sum is: ".$a."\n"; echo "the product is: ".$b."\n"; echo "the smallest element is: ".$c."\n"; echo "the biggest element is: ".$d."\n"; ?>
run
|
edit
|
history
|
help
0
deleted KPS from DOZ
Agência Mais Próxima PHP
Find deadline time according to date in PHP
boost tiktok
test
Website url validation using php
numeros1-100
Add_adress
Kkkkk
HomeWork29.06.2021