Welcome to WebmasterWorld Guest from 54.162.141.212

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

Executing a PHP function in a variable?

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

5+ 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.

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

5+ Year Member



Heh, my fault actually.

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

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?
4:17 pm on Jan 4, 2007 (gmt 0)

5+ Year Member



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

Featured Threads

Hot Threads This Week

Hot Threads This Month