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
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]

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.