Forum Moderators: coopster

Message Too Old, No Replies

Executing a PHP function in a variable?

         

FuzzyLogik

4:47 pm on Jan 3, 2007 (gmt 0)

10+ Year Member



I have a function,

function output($output) {
echo $output;
}

I have a variable,
$myvar = 'This is my variable. The output is X';

How do I combine the two?

I've tried:

$myvar = 'This is my variable. The output is' . output("this thing");

But no such luck.

FuzzyLogik

5:03 pm on Jan 3, 2007 (gmt 0)

10+ Year Member



Heh, my fault actually.

I guess I should be using "return" instead of "echo" for functions :)

LBmtb

5:08 pm on Jan 3, 2007 (gmt 0)

10+ Year Member



Doesn't work for you? That works for me just fine. Does your file have a .php extension or is htaccess to prase the html properly?

pixeltierra

4:17 pm on Jan 4, 2007 (gmt 0)

10+ Year Member



Echo and Return are extremely different concepts that in certain circumstances can acheive the same result. Read up on the output buffer.