This is a discussion on "problem working with an array of objects" within the PHP Forum section. This forum, and the thread "problem working with an array of objects are both part of the Program Your Website category.
|
|
|
|
|
![]() |
||
problem working with an array of objects
|
||
| Notices |
![]() |
|
|
LinkBack | Thread Tools |
|
|||
|
problem working with an array of objects
Hi there. I'm an Java developer who has taken up PHP5 - drawn to it by its OO support. But I'm having difficulty achieving similar syntax when dealing with an array of objects.
In PHP, the following works on two lines, but not on one, thus requiring two variables to be instantiated. $ranges = $this->collection->getRanges(); $this->range = $ranges[0]; I don't need to assign to the variable $ranges, bt I can't seem to use the syntax: $this->range = ($this->collection->getRanges())[0]; I thought perhaps I might need to cast the array, but this doesn't hepl i.e. $this->range = ((Ranges)$this->collection->getRanges())[0]; any ideas? |
|
|
![]() |
| Tags |
| array objects |
| Thread Tools | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| [SOLVED] Fetch Array problem | Aso | PHP Forum | 3 | Dec 4th, 2007 16:13 |
| Removing objects in an array | breepupetstofight | ASP.NET Forum | 0 | Sep 17th, 2007 13:00 |
| Sorting a new array from an existing array | Ozeona | Flash & Multimedia Forum | 2 | Sep 20th, 2005 08:43 |
| array unable to check another array so as to be displayed | Ozeona | Flash & Multimedia Forum | 1 | Aug 5th, 2005 10:26 |
| Array problem | netwarriorgizmo | JavaScript Forum | 1 | Jul 12th, 2004 21:25 |