Mailinglisten-Archive |
Hiho,
> ----------
> Von: Thomas Pons[SMTP:tom_(at)_huno.net]
>
> wie kann ich aus einer function() 2 $variablen returnen ?
> Irgendwie akzeptiert er immer nur eine.
>
function return_two() {
return array(1,2);
}
list($eins, $zwei) = return_two();
echo $eins.'<br>'.$zwei;
> oder noch besser wäre: wie deklarier ich alle $variablen im script als
> global
> wenn das überhaupt geht ?
>
Ich glaub nicht auf einen Schlag, aber....
> ich würde das script halt ganz gerne mit functions()
> strukturieren.
>
$name = 'Mathias';
function print_hallo(){
echo 'Hallo '.$GLOBALS['name'];
}
ODER:
function print_hallo(){
global $name;
echo 'Hallo '.$name;
}
Viele Grüße, Mathias
php::bar PHP Wiki - Listenarchive