Reply to Re: What does -> do?

Your name:

Reply:


Posted by raghuanandy@gmail.com on 01/13/07 12:06

Manfred Kooistra wrote:
> I have these pieces of example code that I am trying to figure out:
>
> (a) $a = $b->c();
> (b) $d->e();
>
> What does "->" do?
Basically, "->" use to reference variables or functions (or more
precisely members and methods) within a class.
eg:
class Something {
public $a = 'Hello';
function __construct($a)
{ $this->a = $a; }
function SetA($a);
{ $this->a = $a; }
function GetA()
{ return $this->a; }
} //end class

Now the member "a" and methods SetA , GetA can be accessed via the "->"
operator
$obj = new Something('World');

//Access method "GetA" of object "obj" using ->
print $obj->GetA();

//accessing member "a" of object "obj" using ->
$obj->a = 'Hello';
print $obj->a;

> Where is there a reference/explanation in the PHP manual (or anywhere
> else)?
>
> (Unfortunately Google et al. don't search for these characters, so I
> don't know how to look for an explanation on this.)

For more information visit:
http://www.php.net/manual/en/language.oop.php
&
http://www.php.net/manual/en/language.oop5.basic.php

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация