Sylmand Posted January 4, 2009 Share Posted January 4, 2009 Is it possible??? Is it possible to call a method in CLASS2 from a method in CLASS1... I've tried, but it just says "Notice: Undefined property: clUser::$fnSearchEmail in c:/...." Link to comment https://forums.phpfreaks.com/topic/139458-calling-methods-in-classes-from-within-other-classes/ Share on other sites More sharing options...
corbin Posted January 4, 2009 Share Posted January 4, 2009 class c1 { public function test() { echo 'test'; } } class c2 { public function test2($c1) { $c1->test(); } } $c = new c1; $c2 = new c2; $c2->test2(c2); There are of course other ways to get instances inside of other classes. You could use a static function also.... Link to comment https://forums.phpfreaks.com/topic/139458-calling-methods-in-classes-from-within-other-classes/#findComment-729503 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.