How do I catch notice, warning errors in php?

Notice: Undefined property: stdClass::$xxx in /Applications/xxx/xxx/xxx/xxx.php on line 35

Warning: Invalid argument supplied for foreach() in /Applications/xxx/xxx/xxx/xxx.php on line 35

how can I avoid errors like this in the above
?
if I can, I"d like to change it to my own solution
I won"t blame you for seeing it.


users see?
in general, in production systems, the display_errors in php.ini is set to off, so that as long as the user page can be rendered, there will be no error message at the front-end level. When developing, you can write:

at the beginning of the file
  

set_error_handler , set_exception_handler , register_shutdown_function these three methods, you can find various frameworks to see their error exception takeover, or you can use a ready-made class library like whoops.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b347e0-2bf0d.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b347e0-2bf0d.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?