<?php
// Déclaration de la fonction syntaxe PHP 5.6 et +
function Addition(...$parametres)
{$somme=0;
 foreach($parametres as $val) {$somme += $val;}
 return $somme;
}
echo "Entrez 2 entiers : ";
fscanf(STDIN,"%d %d",$a,$b);
echo "--- Appel de  Addition($a,$b) ---".PHP_EOL;
$resultat=Addition($a,$b);
echo "$a+$b = $resultat".PHP_EOL ;
echo "Entrez 4 entiers : ";
fscanf(STDIN,"%d %d %d %d",$c,$d,$e,$f);
echo "--- Appel de  Addition($c,$d,$e,$f) ---".PHP_EOL;
$resultat=Addition($c,$d,$e,$f);
echo "$c+$d+$e+$f = $resultat".PHP_EOL ;
?>
