Solved

explain why people do this

Posted on 2013-06-08
4
384 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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Suggested Solutions

Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this.Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it is …
Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

776 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