<?php
function cut_vegetables( )
{
// func_num_args returns the total number of parameters
echo 'totally ', func_num_args(), ' vegetables: ';
// func_get_args returns all the parameters as array
$vegetables = func_get_args();
print_r($vegetables);
}
echo "<pre>";
cut_vegetables('tomato');
cut_vegetables('tomato', 'potato');
$onion = 'sliced onion';
cut_vegetables('tomato', 'potato', 'cucember', 5555, $onion);
echo "</pre>";
1