Use the following function to list the contents of one or more nested directories.
Try running the following PHP script.
You will either see normal output or get the following error messages.
The set_error_handler() function can be used in PHP to allow you to catch any run time errors and act accordingly. This function can take two parameters:
- Error Handler : This a string which is the name of the function that will be called if an error is encountered.
- Error Types (optional) : This is an optional parameter used to tell PHP on what error codes to act. This is the same error reporting setting.
The function that is defined in the function must have the following footprint as a minimum.
Appending arrays in PHP can be done with the array_merge() function. The array will take any number of arrays as arguments and will return a single array. Here is an example using just two arrays.
The following code loads the contents of a text file and randomly displays a line from it. You can use this to display a random quote on a page every time it loads.
The first thing to do is grab the mootools library from the site and link it in your web page. You can select different components with mootools, but if you grab the whole thing you can start to play with whatever you want. Put this line of code in the head section of your web page.
The singleton design pattern is used to centralise an object in an application that is used to store changing variables that can then be accessed by other parts of the program. It allows only the single instantiation of an object, hence the name.
Because it is possible to mask your user agent in Opera it is necessary to detect this browser first. There are actually two different ways to hide the user agent in Opera. The default user agent is as follows:
Every time you accept any input from a use you should attempt to validate it. This is to stop users trying to break the site and also corrects silly mistakes that users might introduce to their input.
Before sending off an email to a new user congratulating them on signing up it is best to validate that email address. Here is function that does this.