Wie kann man in PHP aus einer Unterfunktion heraus auf die Variablen einer aufrufenden Funktion zugreifen? Geht das überhaupt?
Im Untenstehenden Beispiel kommt im Moment als output "wasanderes" heraus. D.h. das Unterprogramm ändert die Variable $was nur temporär bzw. erzeugt anscheinend eine lokale Variable.
Code:
<?php
$was="anderes";
function irgendwas()
{
$was="was";
echo $was;
}
irgendwas();
echo $was;
?>
Jak
____________________________________
Join the DNRC |
Godwin\'s Law (thx@stona)
Documentation is like sex: If it\'s good, it\'s very, very good. If it\'s bad, it\'s better than nothing.
\"In theory, theory and practice are the same. In practice, they are not\" (Lawrence Berra)