[Php-it] Prodotto cartesiano tra array

Emiliano Gabrielli (aka AlberT) AlberT at superalbert.it
Fri Jul 7 17:37:42 CEST 2006


On Friday 07 July 2006 17:19, Giovanni Cappellini wrote:
> Avete sottomano una funzione che svolge il compito in oggetto?

funcion scalar($a, $b)
{
    if (!is_array($a) || !is_array($b)) 
        return 'arguments must be arrays !!';
    if (count($a)!==count($b))
        return 'Arrays must be of the same size!';

    for ($i=0; $i<count($a); ++$i)
       $s += $a[$i]*$b[$i];
    return $s;
}

se non mi ricordo male le basi (arfioo) :-P

-- 
<?php echo '     Emiliano Gabrielli (aka AlberT)     ',"\n",
'  socio fondatore e membro del direttivo del GrUSP  ',"\n",
' AlberT_at_SuperAlberT_it   -   www.SuperAlberT.it  ',"\n",
'  IRC:    #php,#AES azzurra.com ',"\n",'ICQ: 158591185'; ?>


More information about the Php-it mailing list