riddhi Posted January 14, 2008 Share Posted January 14, 2008 When should one use -> in php what is its purpose? Quote Link to comment https://forums.phpfreaks.com/topic/85936-solved-what-is-the-propose-of/ Share on other sites More sharing options...
trq Posted January 14, 2008 Share Posted January 14, 2008 It is used to access an objects methods and properties. Quote Link to comment https://forums.phpfreaks.com/topic/85936-solved-what-is-the-propose-of/#findComment-438727 Share on other sites More sharing options...
dooper3 Posted January 14, 2008 Share Posted January 14, 2008 it refers to the use of php classes. Classes can contain many functions, so if you see something like: $dog->needs The code refers to the function $needs (note no $ sign before $needs though) within the class $dog. I'm quite a noobie to classes myself, so maybe slightly wrong! They're useful for grouping common functions and doing object oriented programming (OOP). Google for more info, it's a big topic! Quote Link to comment https://forums.phpfreaks.com/topic/85936-solved-what-is-the-propose-of/#findComment-438729 Share on other sites More sharing options...
riddhi Posted January 14, 2008 Author Share Posted January 14, 2008 what should be the exact term for searching?? Quote Link to comment https://forums.phpfreaks.com/topic/85936-solved-what-is-the-propose-of/#findComment-438731 Share on other sites More sharing options...
trq Posted January 14, 2008 Share Posted January 14, 2008 A simple example maybe? <?php class foo { public a; public function __construct() { $this->a = 'this is a property'; } public function b() { return 'this is a method'; } } $foo = new foo; echo $foo->a; echo $foo->b; ?> Quote Link to comment https://forums.phpfreaks.com/topic/85936-solved-what-is-the-propose-of/#findComment-438734 Share on other sites More sharing options...
dooper3 Posted January 14, 2008 Share Posted January 14, 2008 do a google search for "php classes" (KEEP the quote marks), you could add "+tutorials" for good measure (without the quote marks on that bit!). Quote Link to comment https://forums.phpfreaks.com/topic/85936-solved-what-is-the-propose-of/#findComment-438735 Share on other sites More sharing options...
trq Posted January 14, 2008 Share Posted January 14, 2008 what should be the exact term for searching?? Its all covered in the oop section of the manual. Quote Link to comment https://forums.phpfreaks.com/topic/85936-solved-what-is-the-propose-of/#findComment-438736 Share on other sites More sharing options...
riddhi Posted January 14, 2008 Author Share Posted January 14, 2008 THanks a lot to thorpe and dooper3 for those help. Quote Link to comment https://forums.phpfreaks.com/topic/85936-solved-what-is-the-propose-of/#findComment-438738 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.