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


 

These are variables currently registered to a script's session. They are analogous to the old $HTTP_SESSION_VARS array, still available, but deprecated. See the session handling functions section for more information.

The Sessions, GET and POST method is covered in detail in the next chapter.  For now, focus remains on PHP and functions. 

In the example above, the global variable is a variable from the main program imported into the scope of the function. Global variables should not be confused with staticvariables, which retain their value between invocations. 

Before static variables are explained, another small detail from the example above should be clarified: the functions "isset" and "strlen".  The function "strlen" is the same as in C or C++ and returns the length of the string given as the argument. The "isset" checks whether the variable given as its argument is defined ("set").  A variable is defined when it is referenced for the first time. These two functions are two among the many useful functions provided by the authors of PHP.

Focus can now return to staticvariables. What are they? They are variables that retain the value between function invocations. Every local variable is normally created at the beginning of the function invocation and destroyed when the function returns. This means that a "normal" variable is created anew for each invocation. Static variables are not recreated each time a function is called.

How are they declared? It is simple. Instead of using the word "global", the word "static " is used. What are they used for? Static variables are mainly used as a counter, because they count the number of times a function is invoked. The example for the static variables is extremely simple and is a re-engineered example9.php, with the preferred factorial function.                

Example 9a:

$ cat ./example9a.php
#!/usr/local/bin/php
<?php
function factorial($n) {
   static $count
=0;
   $count
++;
   if ($n>1) return($n*factorial($n-1));
   else { echo "Number of factorial invocations:$count
\n";
          return(1);
   }
}
$a=6;
$b=factorial($a);
echo "Factorial($a)=$b\n";
?>

Variable $count is declared as staticand initialized to zero. Without the keyword "static", the variable is created during each invocation, set to zero and incremented by one. The finalnumber of invocations printed is "1" with the variable $count declared as static. 

The output looks like it should:

$ ./example9a.php
Number of factorial invocations:6
Factorial(6)=720

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.