Solved

explain why people do this

Posted on 2013-06-08
4
392 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
4 Comments
 
LVL 110

Expert Comment

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

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 110

Expert Comment

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

Featured Post

WordPress Tutorial 1: Installation & Setup

WordPress is a very popular option for running your web site and can be used to get your content online quickly for the world to see. This guide will walk you through installing the WordPress server software and the initial setup process.

Question has a verified solution.

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

Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
There are times when I have encountered the need to decompress a response from a PHP request. This is how it's done, but you must have control of the request and you can set the Accept-Encoding header.
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 create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

627 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