Microsoft Word - Core PHP Programming Using PHP to Build Dynamic Web Sites

(singke) #1

is an object or array, special notation is used to show indices or property names. Arrays
and objects are explored recursively in the cases where objects or arrays are contained
within each other.


<?
//define some test variables
$s = "a string";
$a = array("x", "y", "z", array(1, 2, 3));


//print a string
print_r($s);
print("\n");


//print an array
print_r($a);
print("\n");
?>


show_source


Use show_source as an alias to highlight_file.


syslog(integer priority, string message)


The syslog function adds a message to the system log. It is a wrapper for C's function of
the same name. The priority is an integer that stands for how severe the situation is.
Under UNIX the priority may cause the system to take special measures. Priorities are
listed in Table 8.14.


Under Windows NT, emulation code is used to simulate the UNIX functionality.
Messages generated by the syslog function are added to theapplication log, which may be
viewed with Event Viewer. The priority isused in two ways. First, it is translated into
being either an error, a warning, or information. This determines the icon that appears
next to the message in Event Viewer. It is also used to fill the Category column. The
Event column will always be set to 2000 and the User column will be set to null.


Table 8.14. syslog Priorities
Constant Priority Description

_EMERG (^) Emergency
This is a panic situation and the message may be broadcast to
all users of the system. On Windows this is translated into a
warning.
_ALERT (^) Alert This is a situation that demands being corrected immediately.
It is translated into being an error on Windows.
_CRIT (^) Critical This is a critical condition that may be created by hardware
errors. It is translated into being a warning on Windows.
_ERR (^) Error These are general error conditions. They are translated into

Free download pdf