View Single Post
Old 06-05-2005, 05:15 PM   #4 (permalink)
jaswinder_rana
The Acquainted
 
Join Date: May 2005
Posts: 106
Thanks: 0
jaswinder_rana is on a distinguished road
Default

using variables to store and call functions

You can use variables to store function names and then call them.
PHP Code:
$functionName 'sha1';
echo 
$functionName('string');

$functionName 'md5';
echo 
$functionName('string'); 
Where its useful?
Like the example i shown you. You can store an encrypting function the nuse it alter. Then suppose somebody wants you to change all the encoding functions throughout the site
from
md5()

to
sha1()

So, if you can have a variable in which you can store function name and then store it in your config file. Then whenever you want to change it just change it in your config file and it'll change everywhere globally.
__________________
---------------------------
Errors = Improved Programming.
Portfolio
Send a message via MSN to jaswinder_rana
jaswinder_rana is offline  
Reply With Quote