bolven2000 Posted July 30, 2010 Share Posted July 30, 2010 class Z { function foo() { // do somethig } } class X { $x function __contruct() { $this->x = new z(); } function var() { $this->x->foo(); // Fatal error: Using $this when not in object contex } } // Class declaration here class Y { function __contruct() { $z = new z(); $x = new x(); } } Quote Link to comment https://forums.phpfreaks.com/topic/209318-class-problem/ Share on other sites More sharing options...
trq Posted July 30, 2010 Share Posted July 30, 2010 Post your ACTUAL code. That example will not run for numerous reasons. Quote Link to comment https://forums.phpfreaks.com/topic/209318-class-problem/#findComment-1092988 Share on other sites More sharing options...
onlyican Posted July 30, 2010 Share Posted July 30, 2010 Also need to know what version of PHP you use as OOP is different in V5 and V4 Quote Link to comment https://forums.phpfreaks.com/topic/209318-class-problem/#findComment-1093001 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.