dezkit Posted May 28, 2008 Share Posted May 28, 2008 im new to functions and i was wondering, why isnt this working? <?php function name(){ $firstname = "Pamela"; $lastname = "Anderson"; echo "$firstname $lastname"; } echo "The hottest bitch in the world is ".name(); ?> it displays, "Pamela AndersonThe hottest bitch in the world is" Link to comment https://forums.phpfreaks.com/topic/107558-solved-functions-new/ Share on other sites More sharing options...
dezkit Posted May 28, 2008 Author Share Posted May 28, 2008 nevermind, i figured it out, now is there a way to echo (or whatever its called) a function in an echo? like: echo "The hottest bitch in the world is name()"; Link to comment https://forums.phpfreaks.com/topic/107558-solved-functions-new/#findComment-551321 Share on other sites More sharing options...
Prismatic Posted May 28, 2008 Share Posted May 28, 2008 nevermind, i figured it out, now is there a way to echo (or whatever its called) a function in an echo? like: echo "The hottest bitch in the world is name()"; <?php function name(){ $firstname = "Pamela"; $lastname = "Anderson"; return $firstname ." ". $lastname; } echo "The hottest bitch in the world is ". name(); ?> Link to comment https://forums.phpfreaks.com/topic/107558-solved-functions-new/#findComment-551324 Share on other sites More sharing options...
dezkit Posted May 28, 2008 Author Share Posted May 28, 2008 heh, thanks, got it Link to comment https://forums.phpfreaks.com/topic/107558-solved-functions-new/#findComment-551325 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.