Guest askjames01 Posted April 29, 2006 Share Posted April 29, 2006 OK, i think i'm starting to full in love with the CLASS.$mg2->getlanguages();is this mean assignment;fetch properties from getlanguages() and assign them into $mg2 'Class'?orsimply call getlanguages(); function to execute?Which do you think are correct? or are they all wrong and you have a much morebetter idea? then let me know? please i need to master CLASS.any help will be very appreciated... thanks n advance. Quote Link to comment https://forums.phpfreaks.com/topic/8727-class-question/ Share on other sites More sharing options...
ToonMariner Posted April 29, 2006 Share Posted April 29, 2006 neitherfirst off - if this is out side the class then unless you have instantiated a class and given it the identifier $mg2 then it will throw an error.So first you would need something like...$mg2 = new YourClass;now if you simply had $mg2->getlanguages();then providing that function was defined in your class it will be 'executed' but unless you have anything in you function to perform anything - like set a session var or print info or something it won't help you much. For example - if the function simply queried the database for what languages were installed and nothing else you could not access any of that info.now if you did...$info = $mg2->getlanguages();this would return teh result of the function and you now have access to it so you can do 'stuff'. Quote Link to comment https://forums.phpfreaks.com/topic/8727-class-question/#findComment-32047 Share on other sites More sharing options...
Guest askjames01 Posted April 30, 2006 Share Posted April 30, 2006 I don't want to argue with this code, because it came from a photogallery scriptwhich i'm currently studying piece by piece & code by code and the entire scriptrun very well without error.here take a look for yourself;[a href=\"http://www.askjames01.com/photogallery/\" target=\"_blank\"]php photogallery script[/a]so i assume that single line of code works very fine.and then base on your explanation this is an execution right? Quote Link to comment https://forums.phpfreaks.com/topic/8727-class-question/#findComment-32094 Share on other sites More sharing options...
wildteen88 Posted April 30, 2006 Share Posted April 30, 2006 [code]$mg2->getlanguages();[/code]Yes what the code does is execute the function getlanguages in the [b]mg2[/b] class.I think what getlanguages() function does is gets all the lanaguges from a database and then stores them in a variabale in side the mg2 class. Quote Link to comment https://forums.phpfreaks.com/topic/8727-class-question/#findComment-32123 Share on other sites More sharing options...
Guest askjames01 Posted April 30, 2006 Share Posted April 30, 2006 nice...you are really qualified to be a moderator [b]wildteen88[/b]!eric really knows the right person to be a moderator.thanks again [b]wildteen.[/b]cheers. :)i hope i can reach your level of programming, i'm so determine to be an elite programmer too...although i'm a little late already but i don't want to lost hope... Quote Link to comment https://forums.phpfreaks.com/topic/8727-class-question/#findComment-32143 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.