If I have to call to a third-party legacy function that doesn't allow proper error checking,
is there a global counter on how many error-notices were already triggered by a php script?
I would like to detect in my script if there were errors/warnings/notices during a function call triggered and react accordingly in my script.
As a workaround, I would go for counting the number of rows in the apache errorlog before and after the function call, but that doesn't work:
echo "Logsize before:".$errorlogsize_before."; Logsize after:".$errorlogsize_after."
I'll assume your use case is a call to a third-party legacy function that doesn't allow proper error checking. In that case, you can change the error handler temporarily with set_error_handler() and restore it afterwards with restore_error_handler(). Other alternatives like error_get_last() discard all errors but the last one.