General Programming Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingGeneral Programming Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
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  
Old December 18th, 2002, 04:20 AM
Ben Rowe
Guest
Dev Articles Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
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

Reply With Quote
  #2  
Old December 18th, 2002, 09:38 AM
crazytrain81 crazytrain81 is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Aug 2002
Posts: 232 crazytrain81 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
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'

Reply With Quote
  #3  
Old December 18th, 2002, 12:30 PM
Brian Rosner Brian Rosner is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2002
Location: Denver, CO
Posts: 34 Brian Rosner User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
Send a message via ICQ to Brian Rosner Send a message via AIM to Brian Rosner Send a message via Yahoo to Brian Rosner
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.

Reply With Quote
  #4  
Old December 18th, 2002, 02:54 PM
Ben Rowe
Guest
Dev Articles Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
cool, thanks for the information

Reply With Quote
  #5  
Old December 18th, 2002, 03:39 PM
crazytrain81 crazytrain81 is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Aug 2002
Posts: 232 crazytrain81 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
smack

Reply With Quote
  #6  
Old December 18th, 2002, 07:22 PM
Ben Rowe
Guest
Dev Articles Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
lol

ok, im using my super cool function now, and it works like a charm, feel free to use it.

Reply With Quote
  #7  
Old December 22nd, 2002, 06:01 AM
infamous-online infamous-online is offline
Moderator
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2002
Posts: 404 infamous-online User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 24 m 44 sec
Reputation Power: 7
Talking

Quote:
Originally posted by Ben Rowe
lol

ok, im using my super cool function now, and it works like a charm, feel free to use it.



it's strange to see you get stuck on a script ben
__________________
Apache Expert

Reply With Quote
  #8  
Old December 22nd, 2002, 04:46 PM
visualdensity visualdensity is offline
Absolut Bummer
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Dec 2002
Location: Jungle
Posts: 51 visualdensity User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
Gee... I'm so lost with what you guys have said...

I gotta start doing more studying...
__________________


Reply With Quote
  #9  
Old December 22nd, 2002, 05:36 PM
Ben Rowe
Guest
Dev Articles Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
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.

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingGeneral Programming Help > smack me!


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway