$POINTER = “rebelbar”; Function rebelbar($what_bar);
{
Echo “not just rebelbar, $what_bar rebelbar.”;
}
How can you call the function rebelbar using $POINTER; without directly calling the function rebelbar. anyone?
$POINTER = “rebelbar”; Function rebelbar($what_bar);
{
Echo “not just rebelbar, $what_bar rebelbar.”;
}
How can you call the function rebelbar using $POINTER; without directly calling the function rebelbar. anyone?
Last edited by zyreena; 05-07-2009 at 10:07 PM. Reason: forgot something
Are you looking for variable functions? Other than that, any function that takes a callback (such as array_map) could be used to indirectly call a function. Is this just a puzzle or do you have a use in mind?
Did you write your code in MS Word, by any chance? The smart quotes it generates won't work for PHP. The smart caps look weird, but won't cause problems with the sample you posted. Use a text editor or an IDE to code. When you post code, put it in "[code]" or "[php]" tags to separate it from the rest of your post.
You've also got an errant ";" after your function declaration. Here's what your code looks like after corrections and with indentation to improve readabiliy:
PHP Code:$POINTER = 'rebelbar';
function rebelbar($what_bar) {
echo "not just rebelbar, $what_bar rebelbar.\n";
}
Last edited by misson; 05-07-2009 at 10:24 PM.
tnx misson for the reconstruction of my code, this is my first time to look for help using this forum and a beginner with php.
regarding your question if i do have a use in my mind? yes i do hav. and i need help how to call the function rebelbar using the $POINTER variable. can i do that or im just critically thinking in a wrong way?
Maybe you missed misson’s link to variable functions, so just in case, here you go:
PHP Code:<?php
$what_bar = 'your bar';
$POINTER = 'rebelbar';
$POINTER($what_bar); // This calls function rebelbar()
function rebelbar($what_bar) {
echo "not just rebelbar, $what_bar rebelbar.\n";
}
?>
yah. i really did miss missons "variable function"
tnx misson and gomarc.
Best bet Zyreen, is think about getting a PHP IDE, this will syntax check your code for you. There's BluMentals' Rapid PHP or PHP Designer. They do syntax check and display syntax colors.....they're not extremely expensive and do the job
Here are the links, if you're interested in these 2 things.....
Code:http://www.mpsoftware.dk/products.php http://www.blumentals.net/rapidphp/
tnx odieusg
Edit:
thanks very much everyone.
]
how do i close this thread? moderators please close.
Last edited by zyreena; 05-10-2009 at 10:32 AM. Reason: Automerged Doublepost
@zyreena
We usually don`t close the posts, as somebody migth need to add something, or add precision. We only close them went there is a clear misconduct toward the rules.
█ Xavier L | Community Public Relations Manager (Free Hosting Support)
█ Yes, my position is too cool to even exist!
█ How am I helping? Rate this post by clicking theicon below! (this is even better than "liking" a post)
█ Terms of Service | Acceptable Use Policy | x10Hosting Wiki
ahh. ok tnx. den