MemoryRefresh!

Variable



Questions Answers 0%

Pages   0 from 51
Questions   0 from 84

Reset




<?php $name = 'foo'; $$name = 'bar'; echo $foo; // Displays 'bar' It is possible to create variables whose names do not follow the variables constraints.
<?php $name = '123'; $$name = '456'; echo ${'123'}; // output 456 Variable variables are a very powerful tool, and should be used with extreme care. Their improper use can lead to some significant security issues. A technique similar to variable variables can also be used to hold function names inside a variable:
<?php function myFunc() { echo 'myFunc!'; } $f = 'myFunc'; $f(); // output myFunc!
Questions

Related pages

Definition !
Variable !
Check !
Type casting !
Array to object !
New object !


0% 100%
 
 
0 pages 51 pages
1) What will be the output? <?php $name = 'foo'; $$name = 'bar'; echo $foo;





2) Fill the blank <?php $name = '123'; $$name = '456'; echo _______; // output 456





3) What will be the error (if any) in case of the following code <?php function foo() {} $function = "foo"; $function();





Last Review: n/a   Passed: n/a   Reviews: n/a   Next Review: n/a  



<?php $name = 'foo'; $$name = 'bar'; echo $foo; // Displays 'bar' It is possible to create variables whose names do not follow the variables constraints.
<?php $name = '123'; $$name = '456'; echo ${'123'}; // output 456 Variable variables are a very powerful tool, and should be used with extreme care. Their improper use can lead to some significant security issues. A technique similar to variable variables can also be used to hold function names inside a variable:
<?php function myFunc() { echo 'myFunc!'; } $f = 'myFunc'; $f(); // output myFunc!



More from Php

Basics
Variables
Operators
Function
Array
String
Streams
Uncategorized


More from Programming

Php
jQuery




Powered by minte9.com