Solved

explain why people do this

Posted on 2013-06-08
4
389 Views
Last Modified: 2013-06-10
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
0
Comment
Question by:Easyrider43
  • 3
4 Comments
 
LVL 109

Expert Comment

by:Ray Paseur
ID: 39231420
Start your learning adventures here:
http://php.net/manual/en/language.oop5.php
0
 
LVL 109

Accepted Solution

by:
Ray Paseur earned 500 total points
ID: 39231427
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
 
LVL 1

Author Closing Comment

by:Easyrider43
ID: 39231434
very nice explanation, I love it.
0
 
LVL 109

Expert Comment

by:Ray Paseur
ID: 39234498
Thanks for the points, ~Ray
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

789 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question