Share on Google+Share on Google+

PHP Variable Functions

PHP Variable functions are used to assign a function's name to a variable. In this current PHP tutorial, we will study about that, how to declare php variable functions, how to assign, how to call via a variable and how to pass values.

PHP Variable Functions:

Learn PHP Variable Function means that if a variable name has a format like this $var(), PHP will consider this as a variable function and will look for a function with a name which is assigned to it, and will try to execute it.

This variable function does not work with echo(), print(), unset() etc language constructs.

PHP Example:/strong>


function fun()


echo "This is an example";


function disp($var){

echo "<br/>Value is:".$var;





$f('New Val');




This is an example
Value is:New Val




Posted on: March 2, 2010 If you enjoyed this post then why not add us on Google+? Add us to your Circles

Share this Tutorial Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.