PHP Notices and How To Stop Them

PHP Notices and How To Stop Them
First of all, a notice is not the same as an error message. If your program causes an error message, the program will stop right there and will not finish. However, notices do not stop the program. The notice is printed to the browser and the program continues. There may be times when you want to stop these notices from displaying in the browser.

Here is a common example of a notice that you might get because you tried to use the $string variable that does not exists.

<?php
echo $string;
?>

Notice: Undefined variable: string in C:\sokkit\site\test.php3 on line 2

Perhaps you are working on a program and you want to turn off this notice so you can continue working without recoding this problem area. You can prevent the notice from displaying in the browser by placing an @ sign at the location in the code where the notice would be generated. Just don't forget to go back and recode the problem area later!

echo @$string;


There is more PHP here at BellaOnline--

++Are you interested in learning to program in PHP from the ground up. Learn the basics one step at a time. Check out the PHP Basics articles.

++Are you looking for information about PHP functions. Here are explanations for some of the most frequently used functions.

++Build your own Personal Activities Calendar Program here and learn how the HTML form works with the PHP program.

++Follow these step-by-step tutorials to understand the relationship between PHP and databases.

++Read the latest book reviews on PHP related books.

++Read about online resources for the PHP community.





This site needs an editor - click to learn more!



RSS
Related Articles
Editor's Picks Articles
Top Ten Articles
Previous Features
Site Map





Content copyright © 2023 by Diane Cipollo. All rights reserved.
This content was written by Diane Cipollo. If you wish to use this content in any manner, you need written permission. Contact BellaOnline Administration for details.