Jump to content


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

  • Please log in to reply
3 replies to this topic

#1 sambib

  • Members
  • PipPipPip
  • Advanced Member
  • 35 posts

Posted 24 September 2006 - 11:33 PM

$CFG->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...?


#2 Barand

  • Moderators
  • Sen . ( ile || sei )
  • 18,021 posts

Posted 24 September 2006 - 11:45 PM

You are reading the wrong books. Try the php manual

If you are still using mysql_ functions, STOP! Use mysqli_ or PDO. The longer you leave it the more you will have to rewrite.

Donations gratefully received


|baaGrid| easy data tables - and more
|baaChart| easy line, column and pie charts

#3 yonta

  • Members
  • PipPipPip
  • Advanced Member
  • 70 posts

Posted 24 September 2006 - 11:47 PM

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 http://www.phpfreaks...rials/48/0.php
do it, do it right, do it right now

#4 sambib

  • Members
  • PipPipPip
  • Advanced Member
  • 35 posts

Posted 25 September 2006 - 12:18 AM

thanks guys, just what I wanted....!

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users