Results 1 to 2 of 2

Thread: how to include classes and objects dynamically in php

  1. #1
    Join Date
    Apr 2010
    Posts
    5
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default how to include classes and objects dynamically in php

    Hello, Can any one tell me the concept of including classes and instance/ objects dynamically.

  2. #2
    Join Date
    Mar 2010
    Posts
    28
    Thanks
    0
    Thanked 4 Times in 4 Posts

    Smile

    A. If you wanted to know about php serialisation/unserialisation to save objects in databases and use them dynamically,please read more about it.

    B. If you wanted to know about including classes and auto loading them, please read about these methods.

    a. spl_autoload_register('autoloading method name',false);

    b. function __autoload($class) {
    if(is_file($class . '.php')){
    require_once $class.'.php';
    }else{
    printf("Error when trying to load %s", $class);
    }
    }

    $okObj = new okClass();

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •