explain why people do this

how do programmers write functions where they can call functions within other functions for example...

$className->functionName->anotherFunction->PassVariable('something');

is that even a class or am I looking at something wrong maybe its an array someone please explain this to me so I can get new ideas on coding..

Thanks Experts
LVL 1
Easyrider43Asked:
Who is Participating?
 
Ray PaseurConnect With a Mentor Commented:
In PHP, the -> is object-oriented notation.  It refers to a property or method of an object.  Properties are data elements.  Methods are functions.  All method names end in parentheses, with or without arguments inside the parens.  This notation is somewhat similar to the ['xxx'] notation that would refer to an array at the position denoted by the associative index xxx.

Like arrays, objects can have nested elements.  Objects can contain other objects and even arrays of objects.  The "depth" of this nesting is essentially unlimited (JSON imposes some limits, but they are so deep that nobody would ever hit bottom).

XML can be converted to PHP objects via SimpleXML.  The resulting objects may be nested in ways that are similar to your original example.  You can use iterators like foreach() to access the properties of the resulting objects.
0
 
Ray PaseurCommented:
Start your learning adventures here:
http://php.net/manual/en/language.oop5.php
0
 
Easyrider43Author Commented:
very nice explanation, I love it.
0
 
Ray PaseurCommented:
Thanks for the points, ~Ray
0
All Courses

From novice to tech pro — start learning today.