2 Replies - 596 Views - Last Post: 11 January 2010 - 04:26 PM Rate Topic: -----

#1 Auzzie  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 43
  • View blog
  • Posts: 573
  • Joined: 20-January 09

Loading a class into an array

Posted 11 January 2010 - 10:27 AM

This is more of a question then asking for help, but does anyone know of a way in which you can place all of the functions of a class into an array that would look something like this:

Quote

classname = array(
'__construct', '__destruct', 'setSomething'
);


So you would have an easy way to see if a function existed within a class rather then trying to call a function that might not exist.

Is This A Good Question/Topic? 0
  • +

Replies To: Loading a class into an array

#2 AdaHacker  Icon User is offline

  • Resident Curmudgeon

Reputation: 452
  • View blog
  • Posts: 811
  • Joined: 17-June 08

Re: Loading a class into an array

Posted 11 January 2010 - 12:04 PM

View PostAuzzie, on 11 Jan, 2010 - 11:27 AM, said:

...does anyone know of a way in which you can place all of the functions of a class into an array.... So you would have an easy way to see if a function existed within a class rather then trying to call a function that might not exist.

You wouldn't do that. You would use method_exists() or the reflection API instead. That's what they're there for.
Was This Post Helpful? 1
  • +
  • -

#3 Auzzie  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 43
  • View blog
  • Posts: 573
  • Joined: 20-January 09

Re: Loading a class into an array

Posted 11 January 2010 - 04:26 PM

Thanks for setting me straight AdaHacker :) Also after reading one of the comments, i found a perfect function for what i wanted get_class_methods()

This post has been edited by Auzzie: 11 January 2010 - 04:32 PM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1