Oracle Consulting Oracle Training Oracle Support Development
Home
Catalog
Oracle Books
SQL Server Books
IT Books
Job Interview Books
eBooks
Rampant Horse Books
911 Series
Pedagogue Books

Oracle Software
image
Write for Rampant
Publish with Rampant
Rampant News
Rampant Authors
Rampant Staff
 Phone
 800-766-1884
Oracle News
Oracle Forum
Oracle Tips
Articles by our Authors
Press Releases
SQL Server Books
image
image

Oracle 11g Books

Oracle tuning

Oracle training

Oracle support

Remote Oracle

STATSPACK Viewer

Privacy Policy

 

   
 

ss

Oracle Tips by Burleson 

OO Magic

As in any OO implementation, there are few specific functions that perform special tasks.  For example, the _autoloadfunction is used to load the required class definition functions into the executing script.  In example13.php, there is the following line:

require_once('OCI_Session.php');

If there are several classes, each in its own definition file, those definition files have to be included into the script, each with its own ‘require_once’ line.

This can be awkward and cumbersome. If the PHP interpreter cannot find the definition of a given class $class_name, it will first try to execute function __autoload ($class_name). If the class $class_name is still not defined, the script will be terminated. Thus, the function is defined like this:

    function __autoload ($class_name) {
                     require_once($class_name.'.php');
    }

In example13.php, the programmer forgot to include OCI_Session.php. The script still works because the definition of the class OCI_Session is still included when the class is used. If all class definitions are kept in the files that have the same name as the class that is defined, it becomes unnecessary to write include statements for them as long as the function __autoloadin its above form exists within the script. Of course, the __autoload function can also be placed in an include file.

There are additional special functions in the PHP 5 object model that are outside the scope of this book. The next important part of this chapter deals with sessions.

See code depot for complete scripts


The above book excerpt is from:

Easy Oracle PHP

Create Dynamic Web Pages with Oracle Data

ISBN 0-9761573-0-6   

Mladen Gogala

http://www.rampant-books.com/book_2005_2_php_oracle.htm

 

Download your Oracle scripts now:

www.oracle-script.com

The definitive Oracle Script collection for every Oracle professional DBA

Linux Oracle commands syntax poster

ION Oracle tuning software

Oracle data dictionary reference poster



Oracle Forum

BC Oracle consulting support training

BC remote Oracle DBA   

 

   

 Copyright © 1996 -2016 by Burleson. All rights reserved.


Oracle® is the registered trademark of Oracle Corporation. SQL Server® is the registered trademark of Microsoft Corporation. 
Many of the designations used by computer vendors to distinguish their products are claimed as Trademarks
 

Hit Counter