Jump to content

explain this small piece of PHP code please.....


sambib

Recommended Posts


[b]$CFG->[/b]wwwroot  = 'http://site.local';

i can't find -> anywhere in my two php books or online to tell me what this piece of code is doing...

I'll take a guess that it's seeting a variable to 'http://site.local' but don't really understand why the -> is used or what it's there for...?

thanks
Link to comment
Share on other sites

That has to do with object-oriented coding. An object is mainly a name for an instance of a class.

In this case, $CFG is an object that has a property ('wwwroot'), and this property is being set to 'http://site.local' .

Somewhere in your script(s) there's probably a '$CFG = new NameofClass();' line. Find it and then check the class.

For a better understanding, google php oop tutorial and read some or check here [url=http://www.phpfreaks.com/tutorials/48/0.php]http://www.phpfreaks.com/tutorials/48/0.php [/url]
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.