Mohsin Posted August 10, 2012 Report Share Posted August 10, 2012 hi stefan!! m new engaged with oop php and i was trying to do something like following: <?php class abc { public function mine (){ echo "i m private function"; } public function ham (){ mine(); } } $xyz = new abc(); $xyz->ham(); ?> and i got the error "Fatal error: Call to undefined function mine()". plz help out me Quote Link to comment Share on other sites More sharing options...
falkencreative Posted August 10, 2012 Report Share Posted August 10, 2012 You can't have a space between the function name and the parenthesis. So on line 4, use "mine()" rather than "mine ()". Quote Link to comment Share on other sites More sharing options...
Mohsin Posted August 10, 2012 Author Report Share Posted August 10, 2012 i have done it in the following manner thnx BEN <?php class abc { public function mine (){ echo "i m private function"; } public function ham (){ $this->mine(); } } $xyz = new abc(); $xyz->ham(); ?> Quote Link to comment 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.
Note: Your post will require moderator approval before it will be visible.