homepage Welcome to WebmasterWorld Guest from 54.242.231.109
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
Executing a PHP function in a variable?
FuzzyLogik




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

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




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

Heh, my fault actually.

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

LBmtb




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

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




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

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

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved