PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
n00b
Forum Newbie
Posts: 7 Joined: Tue Dec 24, 2002 1:31 am
Post
by n00b » Tue Dec 24, 2002 1:31 am
I'm reading through the PHP manual. I'm fairly good at PHP, but i never read te manual i learnt from viewing.
I've come across this in the PHP manual, dont know what it is:
class foo
{
var $foo;
var $bar;
function foo()
{
$this->foo = 'Foo';
$this->bar = array('Bar1', 'Bar2', 'Bar3');
}
}
What does $this-> mean? What does the -> mean?
Thanks.
n00b
Forum Newbie
Posts: 7 Joined: Tue Dec 24, 2002 1:31 am
Post
by n00b » Tue Dec 24, 2002 1:36 am
and this:
array("foo" => "bar", 12 => true);
whats => ?
EricS
Forum Contributor
Posts: 183 Joined: Thu Jul 11, 2002 12:02 am
Location: Atlanta, Ga
Post
by EricS » Tue Dec 24, 2002 2:43 am
this-> is a special construct that means use the variable I've defined within THIS class.
mydimension
Moderator
Posts: 531 Joined: Tue Apr 23, 2002 6:00 pm
Location: Lowell, MA USA
Contact:
Post
by mydimension » Tue Dec 24, 2002 10:35 am
the => is used to relate a key with a vlaue in an array. i.e.:
$arr = array("foo" => "bar", 12 => true);
you now can do this:
print $arr['foo']; //outputs bar
print $arr[12]; //outputs 1 - the numerical equivilant to TRUE