Page 1 of 1

Some one can tell me ?

Posted: Wed Sep 12, 2007 5:00 am
by myharshdesigner
What we call this in PHP

Code: Select all

-->

Code: Select all

DOMNodelist->item()
where should we use this And When We use this ?

Posted: Wed Sep 12, 2007 6:34 am
by Maugrim_The_Reaper
It's just an object delimiter. If have a class User you create a new object by calling:

$user = new User();

The $user object, an instance of User, needs a syntax to refer to all the properties and methods it contains. That operator is ->. So to perhaps set a User name, one could:

$user->setName('Me!');

This tells we're calling the setName() method of the $user object. The main exception is if a method or property is static, i.e. you don't need to create an object to use it. So one could create a global User name (assuming a static method exists!) using the different :: syntax.

User::setName('Me!');

The manual explains all this in more detail on the Object Oriented introduction for PHP5.

Posted: Wed Sep 12, 2007 8:08 am
by superdezign
We should turn one of these '->' posts into a sticky.

Posted: Wed Sep 12, 2007 3:24 pm
by feyd
superdezign wrote:We should turn one of these '->' posts into a sticky.
Few search, fewer still would know what to search for as "->" isn't possible to search for. And myharshdesigner, I need to remind you of another rule.... I grow tired of reminding you of these rules.
[url=http://forums.devnetwork.net/viewtopic.php?t=30037]Forum Rules[/url] Section 1.1 wrote:2. Use descriptive subjects when you start a new thread. Vague titles such as "Help!", "Why?" are misleading and keep you from receiving an answer to your question.

Posted: Wed Sep 12, 2007 11:17 pm
by myharshdesigner
my dear friend i know the rule now always search in the form 1st the i post.
but for that

Code: Select all

->
sign i dont know how to search so i just post my query sir.
And if you provide me some result then i will so thanks full to you sir.

Thnaks
feyd wrote:
superdezign wrote:We should turn one of these '->' posts into a sticky.
Few search, fewer still would know what to search for as "->" isn't possible to search for. And myharshdesigner, I need to remind you of another rule.... I grow tired of reminding you of these rules.
[url=http://forums.devnetwork.net/viewtopic.php?t=30037]Forum Rules[/url] Section 1.1 wrote:2. Use descriptive subjects when you start a new thread. Vague titles such as "Help!", "Why?" are misleading and keep you from receiving an answer to your question.

Posted: Wed Sep 12, 2007 11:18 pm
by myharshdesigner
Maugrim_The_Reaper wrote:It's just an object delimiter. If have a class User you create a new object by calling:

$user = new User();

The $user object, an instance of User, needs a syntax to refer to all the properties and methods it contains. That operator is ->. So to perhaps set a User name, one could:

$user->setName('Me!');

This tells we're calling the setName() method of the $user object. The main exception is if a method or property is static, i.e. you don't need to create an object to use it. So one could create a global User name (assuming a static method exists!) using the different :: syntax.

User::setName('Me!');

The manual explains all this in more detail on the Object Oriented introduction for PHP5.
THANKS