Help with php function

zyreena

New Member
Messages
57
Reaction score
0
Points
0
[FONT=&quot]$POINTER = “rebelbar”;[/FONT] [FONT=&quot]Function rebelbar($what_bar);
[/FONT]
[FONT=&quot]{[/FONT]
[FONT=&quot]Echo “not just rebelbar, $what_bar rebelbar.”;[/FONT]
[FONT=&quot]}
[/FONT]
[FONT=&quot]How can you call the function rebelbar using $POINTER; without directly calling the function rebelbar. anyone?[/FONT]
 
Last edited:

misson

Community Paragon
Community Support
Messages
2,572
Reaction score
72
Points
48
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]$POINTER = 'rebelbar'; 

function rebelbar($what_bar) {
    echo "not just rebelbar, $what_bar rebelbar.\n";
}[/php]
 
Last edited:

zyreena

New Member
Messages
57
Reaction score
0
Points
0
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?
 

gomarc

Member
Messages
516
Reaction score
18
Points
18
... 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:
<?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";
}  

?>
 

zyreena

New Member
Messages
57
Reaction score
0
Points
0
yah. i really did miss missons "variable function"

tnx misson and gomarc.
 

OdieusG

New Member
Messages
50
Reaction score
0
Points
0
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/
 

zyreena

New Member
Messages
57
Reaction score
0
Points
0
tnx odieusg
Edit:
thanks very much everyone.
]
how do i close this thread? moderators please close.
 
Last edited:

xav0989

Community Public Relation
Community Support
Messages
4,467
Reaction score
95
Points
0
@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.
 
Top