Asked such a question to me how to display the value of a variable like this.
$m = 10; $k = 'm'; We need to get the value of the variable m through k, how can this be done?
Asked such a question to me how to display the value of a variable like this.
$m = 10; $k = 'm'; We need to get the value of the variable m through k, how can this be done?
This is how PHP can be:
echo $$k; That is, if by a simple, first $k is taken - the result is m , we use the prefix $ , we get $m .
And you can do this:
$foo = 'count'; echo $foo([1, 1, 1]); //выводит 3 Those. the result is a call to the count function. With constructions empty , isset , if else , etc. - it's not gonna go.
Source: https://ru.stackoverflow.com/questions/594096/
All Articles