Northern Flame Posted December 29, 2007 Share Posted December 29, 2007 How could I do this? I created a class and established a function inside of it and now want to insert that function into another function. Will this work? <?php class noLog{ var $room; var $action; function myFunctionContent(){ echo $room . "<h2>blah blah</h2>\n"; echo $room . "<p>blah blah blah ". $this->action ." blah.</p>\n"; } } $class = new noLog; $class->room = $space; $class->action = $_GET['action']; function myFunction(){ global $class; echo $class->myFunctionContent(); } ?> will that work? Or is there something I'm doing wrong? Link to comment https://forums.phpfreaks.com/topic/83566-solved-putting-class-myfunction-into-another-function/ Share on other sites More sharing options...
hasanatkazmi Posted December 29, 2007 Share Posted December 29, 2007 try $this->myFunctionContent(); why are u echo ing it? Link to comment https://forums.phpfreaks.com/topic/83566-solved-putting-class-myfunction-into-another-function/#findComment-425204 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.