#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2000
    Posts
    9
    Rep Power
    0
    Hello All,
    Can I store objects into an array?

    $anArray[$index] = $anObject;
    $anArray[$index]->aMethod();

    I have problems executing the above code. Does anyone knows a better/correct way of doing it? How do I invoke a method belonging to that object?

    Thanks in advance!
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 1999
    Posts
    114
    Rep Power
    16
    In PHP3 I had trouble with this sort of thing, but not in PHP4. What version are you using?
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2000
    Posts
    9
    Rep Power
    0
    Hi scollo,
    Thanx I will have my php upgraded. Do you know whether is there a function which could determine the class of an object? for instance, in java i could use ... "instanceof" to check whether a particular object belong to a particular class?

Similar Threads

  1. sort: find duplicate string elements in array
    By sciencelife in forum Java Help
    Replies: 3
    Last Post: January 27th, 2004, 02:29 PM
  2. my comp sux lately , need help from pro's
    By Hykinsel007 in forum Windows Help
    Replies: 2
    Last Post: January 5th, 2004, 02:52 PM
  3. storing variable in an array
    By collegegirly in forum PHP Development
    Replies: 5
    Last Post: January 5th, 2004, 11:45 AM
  4. Creating an array of arrays of object??
    By kjne8o in forum HTML Programming
    Replies: 0
    Last Post: December 11th, 2003, 02:05 PM
  5. retrieve object from array, then cast to own classtype??
    By koalabeer in forum PHP Development
    Replies: 1
    Last Post: November 29th, 2003, 08:30 AM

IMN logo majestic logo threadwatch logo seochat tools logo