Jump to content

Class question?


Guest askjames01

Recommended Posts

Guest askjames01
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'?

or

simply call getlanguages(); function to execute?

Which do you think are correct? or are they all wrong and you have a much more
better idea? then let me know? please i need to master CLASS.

any help will be very appreciated... thanks n advance.

Link to comment
Share on other sites

neither

first 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'.
Link to comment
Share on other sites

Guest askjames01
I don't want to argue with this code, because it came from a photogallery script
which i'm currently studying piece by piece & code by code and the entire script
run 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?


Link to comment
Share on other sites

[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.
Link to comment
Share on other sites

Guest askjames01
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...

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.