Örnek bir işlev içinde bir değişken bildirimi:
global $$link;
$$ ne demek?
Gibi bir sözdizimi $$variable is called Variable Variable a>.
For example, if you consider this portion of code :
$real_variable = 'test';
$name = 'real_variable';
echo $$name;
Aşağıdaki çıktıyı alırsınız:
test
Here :
$real_variable testi içerir$name sizin değişken adını içerir: 'real_variable'$$name mean "the variable thas has its name contained in $name"
$real_variable'test'EDIT after @Jhonny's comment :
Doing a $$$ ?
Well, the best way to know is to try ;-)
Yani, bu kod bölümünü deneyelim:
$real_variable = 'test';
$name = 'real_variable';
$name_of_name = 'name';
echo $name_of_name . '<br />';
echo $$name_of_name . '<br />';
echo $$$name_of_name . '<br />';
Ve buraya alıyorum çıkış bulunuyor:
name
real_variable
test
Yani, demek, yes, you can do $$$ strong> ;-) olur
Bir variable's variable bulunuyor.
<?php
$a = 'hello';
$$a = 'world'; // now makes $hello a variable that holds 'world'
echo "$a ${$a}"; // "hello world"
echo "$a $hello"; // "hello world"
?>
Bu dinamik bir değişken adı oluşturur. Örneğin
$link = 'foo';
$$link = 'bar'; // -> $foo = 'bar'
echo $foo;
// prints 'bar'
(Aynı zamanda variable variable olarak da bilinir)