Cum pot apela la o variabila aflata intr-o functie. Am urmatorul cod:
Cod: Selectaţi tot
function test () {
$var1 = "test1";
$var2 = "test2";
}
Multumesc!
Cod: Selectaţi tot
function test () {
$var1 = "test1";
$var2 = "test2";
}
Cod: Selectaţi tot
function test($x_y_z) {
$var1 = "test1";
$var2 = "test2";
$variabile = get_defined_vars();
foreach($variabile as $cheie => $valoare)
if($cheie == $x_y_z)
return $valoare;
}
echo test('var1');