How class_exist function is working

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • maheswaran
    New Member
    • Mar 2007
    • 190

    How class_exist function is working

    hi all,

    I have doubt in class_exist funxtion. I know its use to Tests whether a class is defined or not. But i want to know how its work. Is this function check any specific DB or any definition file or its read all php files (for every execution).

    Just i try to upgrade joomla 1.0.15 into 1.5 , in joomla 1.5 there is function called class_exists and it return some result. I really do not know from where it check class_exist function is already defined or not. Is that check in DB or any pre defined function.Else is it check php codes, If its so some function may retrun by us, then how its work....

    Any one give some points regd this.....I tried with joomla code and some manual i could not find.......
  • nathj
    Recognized Expert Contributor
    • May 2007
    • 937

    #2
    Hi Maheswaran,

    Have a read of the PHP manual for class_exists.

    I've never used this function myself but it seems pretty straight forward to me. I'm not sure where it checks, perhaps someone else will chip in, but I assume that PHP stores class instance some place and then checks there when class_exists is called.

    I hope that helps you out a bit.

    nathj

    Comment

    • Dormilich
      Recognized Expert Expert
      • Aug 2008
      • 8694

      #3
      class_exists() looks for the class name in the currently loaded code and usually calls the __autoload() function if the class definition is not found, except when you suppress it by calling class_exists($c lassname, false).

      regards

      Comment

      • Markus
        Recognized Expert Expert
        • Jun 2007
        • 6092

        #4
        maheswaran,

        It is against our forum guidelines to double post a question, like you have done. One thread per question is all you need. You have been here for long enough to understand the Posting Guidelines.

        Please review the posting guidelines to avoid any further warnings.

        Moderator.

        Comment

        Working...