Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Which is the lowest level error type in PHP

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

Editor to share with you which is the lowest level of error type in PHP, I believe most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's learn about it!

The lowest error type in PHP is "deprecated", which means "not recommended, not recommended". This error is generally caused by the use of unrecommended and outdated functions or syntax; although it does not affect the normal process of PHP, it is generally recommended to correct it.

Operating environment of this tutorial: windows7 system, PHP7.1 version, DELL G3 computer

Preface: a php error is a condition that makes the script run abnormally.

There are many kinds of errors in php, including warning, notice, deprecated, fetal error and so on. Among them, notice is not called notification, but notification-level error, and warning is not warning-level error, but warning-level error.

Errors can be roughly divided into the following types.

Deprecated is the lowest level of error, meaning "do not recommend, do not recommend". For example, the regular matching function of the ereg series used in PHP5 reports this kind of error. This error is generally caused by the use of unrecommended and outdated functions or syntax. Although it does not affect the normal process of PHP, it is generally recommended to amend it.

The second is notice. This kind of error is generally inappropriate in grammar. This error will be reported if you use a variable but are not defined. The most common thing is that without quotation marks when the array index is a character, PHP is regarded as a constant, looking for the constant table first, and then as a variable if you can't find it. Although PHP is a scripting language and its syntax is not strict, it is still recommended to initialize variables. This error does not affect the normal process of PHP.

Warning is a high-level error that is reported only when there is a very inappropriate situation in the syntax, such as a mismatch in function parameters. This level of error can result in not getting the expected results and the code needs to be modified.

A higher level of error is fetal error. This is a fatal error that directly leads to the termination of the PHP process and the subsequent code is no longer executed. This kind of problem must be corrected.

The high-level error is the parsing error prase error. The errors mentioned above are PHP code run-time errors, while syntax parsing errors are syntax check phase errors, which will cause PHP code to fail the syntax check.

Here are just a few of the most common ones. There are 16 levels of errors in the php manual.

$date = date ('Ymurmmurd'); if (ereg ("([0-9] {4})-([0-9] {1 echo 2})-([0-9] {1 echo 2})", $date,$regs)) {echo $regs [1]. "-". $regs [2]. ". $regs [3];} else {echo" not matched ". } / / Deprecated (in the php5 version), Fatal error (in the php7 version) if ($I > 2020) {echo'$I is not initialized!', PHP_EOL;} / / Notice $arr = array ('arr'= > 1 mine2pr 3); echo $arr [arr]; / / Warning $res = array_sum ($arr,1) / / Warning echo fun (); / / Fatal error echo "highest level error"; / / Parse error

The above code demonstrates several common error levels in php. If the output is not complete, you can look at the php.ini configuration file to see if the following settings are set.

Error_reporting=E_ALL | E_STRICTdisplay_errors=On

Where error_reporting is the specified error level, display_errors needless to say.

The above is all the content of the article "what is the lowest level of error type in PHP". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report