|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
|
|
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
|
|
#1
|
|||
|
|||
|
smack me!
ok, i use alot of functions and use the switch function to select which function to load.
swith($var) case "test"; include(realpath("filename.php")); functionname(); break; .... so you get the idea, now im developing a cms system and have created a special function function DisplayFunction($file, $function) { $path = "functions/" . $file; include(realpath($path)); $value = $function(); echo $value; } this will replace include(realpath("filename.php")); functionname(); so i would replace it with DisplayFunction("filename.php", "functionname"); this will include and call the function. now this works, but ive got a feelling that calling a function with a variable, is not going to work on all versions of PHP $function(); does any one know what versions of PHP allow you to call a FUNCTION with a variable, hence allowing you to call a dynamic function name (w00p) thx |
|
#2
|
|||
|
|||
|
It goes back a good way, pre 4.0 I believe. You could always just code it as {$function}(); if you want to be safe tho'
|
|
#3
|
|||
|
|||
|
Last night I was reading an old PHP programming book that was written at PHP 3.0 and they used $functionname() in an example. I think you will be pretty safe using it. you could use {$function}() as mentioned above or the eval() function.
|
|
#4
|
|||
|
|||
|
cool, thanks for the information
|
|
#5
|
|||
|
|||
|
smack
|
|
#6
|
|||
|
|||
|
lol
ok, im using my super cool function now, and it works like a charm, feel free to use it. |
|
#7
|
|||
|
|||
|
Quote:
it's strange to see you get stuck on a script ben ![]()
__________________
Apache Expert |
|
#8
|
|||
|
|||
|
Gee... I'm so lost with what you guys have said...
I gotta start doing more studying... ![]() |
|
#9
|
|||
|
|||
|
i wasnt really stuck, more like i just wanted people opion. This CMS system has got to work on a majority of server configurations, so i need it to work.
|
![]() |
| Viewing: Dev Articles Community Forums > Programming > General Programming Help > smack me! |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|