Static variable retains their value across multiple function calls. Let us take an example: Here, the $eaten_count static variable is initialized to 1 and then incremented when if block is entered. So, that the Eaten is echoed only once. This
“Headers already sent” warning doesn’t appear on localhost
Have you ever worked on your local environment – looks fine, and then your live server produces the following error? Warning Cannot modify header information – headers already sent by… This usually happens because output buffering is often
Log PHP data in JavaScript console
There are many built-in methods of logging and troubleshooting in PHP. In most cases, PHP data is logged in an error log file using the error_log() function. The error log is disabled by default in PHP. To enable you’ll need