Basic Error Handling: Using the die Function
The first example shows a simple script that opens a text file. If the file does not exist, an error occurs. |
|
To avoid that the user gets an error message like the one above, we test if the file exists before we try to access it.
The example uses a simple error handling mechanism to stop the script after the error by using the PHP functions:
|
|
In elementary school, in case of fire you have to line up quietly in a single file line from smallest to tallest. What is the logic? Do tall people burn slower? — Warren Hutcherson |