pouncer Posted November 8, 2006 Share Posted November 8, 2006 take for e.g[code=php:0]class Test {function Hello() {echo "hi";}function Bye() {echo "Bye";}function Hmm() {//how do i call Hello() here?}}[/code] Link to comment https://forums.phpfreaks.com/topic/26620-php-class-help/ Share on other sites More sharing options...
blear Posted November 8, 2006 Share Posted November 8, 2006 [code]$this->Hello()[/code]That snipet, anywhere inside the class, will call the function in the class Hello() Link to comment https://forums.phpfreaks.com/topic/26620-php-class-help/#findComment-121761 Share on other sites More sharing options...
pouncer Posted November 8, 2006 Author Share Posted November 8, 2006 ahh, I see now. Thanks.another question while we are here buddy.echo "Welcome back $log->GetUserName()";when i do echo $log->GetUserName();then it echos Johnbut how do i get the first one working? Link to comment https://forums.phpfreaks.com/topic/26620-php-class-help/#findComment-121765 Share on other sites More sharing options...
wildteen88 Posted November 9, 2006 Share Posted November 9, 2006 You will need to to use the concatenation operator (.):[code]echo "Welcome back " . $log->GetUserName();[/code] Link to comment https://forums.phpfreaks.com/topic/26620-php-class-help/#findComment-122215 Share on other sites More sharing options...
Zane Posted November 9, 2006 Share Posted November 9, 2006 or encapsulate it with curly braces[code=php:0]echo "Welcome back {$log->GetUserName()}";[/code] Link to comment https://forums.phpfreaks.com/topic/26620-php-class-help/#findComment-122243 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.