Specifications

$max_execution_time = ini_get(“max_execution_time”);
echo “new timeout is $max_execution_time <br>”;
?>
The ini_set() function takes two parameters. The first is the name of the configuration direc-
tive from php.ini that we would like to change, and the second is the value we would like to
change it to. It returns the previous value of the directive.
In this case, we are resetting the value from the default 30 second maximum time for a script
to run to 120 seconds.
The ini_get() function simply checks the value of a particular configuration directive. The
directive name should be passed to it as a string. Here we are just using it to check that the
value really did change.
Source Highlighting
PHP comes with a built-in syntax highlighter, similar to many IDEs. In particular, it is useful
for sharing code with others, or presenting it for discussion on a Web page.
The functions show_source() and highlight_file() are the same. (The show_source()
function is actually an alias for highlight_file().)
Both of these functions accept a filename as parameter. (This file should be a PHP file, other-
wise you wont get a very meaningful result.) For example,
show_source(“list_functions.php”);
The file will be echoed to the browser with the text highlighted in various colors depending on
whether it is a string, a comment, a keyword, or HTML. The output is printed on a background
color. Content that doesnt fit into any of these categories is printed in a default color.
The highlight_string() function works similarly, but it takes a string as parameter, and
prints it to the browser in a syntax-highlighted format.
You can set the colors for syntax highlighting in your php.ini file. The section you are
looking for looks like this:
; Colors for Syntax Highlighting mode
highlight.string = #DD0000
highlight.comment = #FF8000
highlight.keyword = #007700
highlight.bg = #FFFFFF
Advanced PHP Techniques
P
ART IV
454
LISTING 21.2 Continued
26 7842 CH21 3/6/01 3:41 PM Page 454