Call now: 252-767-6166  
Oracle Training Oracle Support Development Oracle Apps

 
 Home
 E-mail Us
 Oracle Articles
New Oracle Articles


 Oracle Training
 Oracle Tips

 Oracle Forum
 Class Catalog


 Remote DBA
 Oracle Tuning
 Emergency 911
 RAC Support
 Apps Support
 Analysis
 Design
 Implementation
 Oracle Support


 SQL Tuning
 Security

 Oracle UNIX
 Oracle Linux
 Monitoring
 Remote s
upport
 Remote plans
 Remote
services
 Application Server

 Applications
 Oracle Forms
 Oracle Portal
 App Upgrades
 SQL Server
 Oracle Concepts
 Software Support

 Remote S
upport  
 Development  

 Implementation


 Consulting Staff
 Consulting Prices
 Help Wanted!

 


 Oracle Posters
 Oracle Books

 Oracle Scripts
 Ion
 Excel-DB  

Don Burleson Blog 


 

 

 


 

 

 

 

 

Oracle Database Tips by Donald Burleson


 

Includes

Once the functions are defined, it is useful to have them separated into their own file, which can be included from many programs, as they are needed. C and C++ have the #include directive for that purpose, Perl has "require" and "use". PHP, of course, has its own directives for this purpose, namely "require" and "include".

"Require" and "include" are almost identical, except in the way they handle errors. While "include" produces a warning, "require" produces a fatal error. When including a file, the web server executing the PHP script drops into the HTML mode. This means that any PHP code  within the included file must be enclosed between the delimiter tags <?php and ?>. 

Better options are "require_once" and "include_once" directives. The "once" versions keep track of what has been included. If the file has already been included, it is not included again. What would example9.php (the one with factorial) look like if the factorial function is separated in its own file, "factorial.php"?

It would look like the following:

    $ cat example9b.php
    #!/usr/local/bin/php
    <?php
    require 'factorial.php';
    $a=5;
    echo "Factorial($a)=".factorial($a)."\n";
    ?>

The "factorial.php" file looks as expected:

    $ cat factorial.php
    <?php
    function factorial($n) {
       if ($n>0) return($n*factorial($n-1));
       else return(1);
    }
    ?>

And, of course, the execution is just as easy:

    $ ./example9b.php
    Factorial(5)=120

PHP supports nested includes. This means that the included file can itself include another file. All files are included in the syntactical scope of the "include" statement itself. If the included file includes variable definitions, those variables are local to the function which included the file.

The last question is, "how does PHP know where to find the files to include?" There is a parameter called "include_path" in the php.ini parameter file which serves precisely for that purpose. This parameter is mentioned several more times in upcoming chapters.

See code depot for complete scripts

This is an excerpt from the book Easy Oracle PHP.  You can get it for more than 30% by buying it directly from the publisher and get instant HTML-DB scripts from the code depot:

Easy Oracle PHP
Create Dynamic Web Pages with Oracle Data

Includes online HTML-DB code depot

Buy it now for 30% off - Only $19.95
 

HTML-DB support:

For HTML-DB development support just call to gat an Oracle Certified professional for all HTML-DB development projects.

 

 

��  
 
 
Oracle Training at Sea
 
 
 
 
oracle dba poster
 

 
Follow us on Twitter 
 
Oracle performance tuning software 
 
Oracle Linux poster
 
 
 

 

Burleson is the American Team

Note: This Oracle documentation was created as a support and Oracle training reference for use by our DBA performance tuning consulting professionals.  Feel free to ask questions on our Oracle forum.

Verify experience! Anyone considering using the services of an Oracle support expert should independently investigate their credentials and experience, and not rely on advertisements and self-proclaimed expertise. All legitimate Oracle experts publish their Oracle qualifications.

Errata?  Oracle technology is changing and we strive to update our BC Oracle support information.  If you find an error or have a suggestion for improving our content, we would appreciate your feedback.  Just  e-mail:  

and include the URL for the page.


                    









Burleson Consulting

The Oracle of Database Support

Oracle Performance Tuning

Remote DBA Services


 

Copyright © 1996 -  2020

All rights reserved by Burleson

Oracle ® is the registered trademark of Oracle Corporation.