Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can I string together object references, eg: $foo->bar()->try() ?

Status
Not open for further replies.

AnilKumar

Programmer
Dec 5, 2000
26
IN
How can I call method on object return by a method, if I just call $foo->bar()->try() I am getting parse error.

 
If the error is specifically "Parse error", your code may have an error unrelated to the nested object calls. Check the lines before the line that generates the error, looking for unmatched braces, brackets, quotes, etc., or missing semicolons. Want the best answers? Ask the best questions: TANSTAAFL!
 
I have successfully used sub class's within class's, however, I stored the sub class in a variable, it looks like you are trying to use a function to access it.

Be sure the function returns an object, or if you didn't mean to use a function, remove the brackets. --BB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top