Note: This post is over a year old and so the information contained here might be out of date. If you do spot something please leave a comment and we will endeavour to correct.
It is sometimes a good idea to find out where users can come from. When PHP is run the $_SERVER superglobal is always available and if the user has clicked on a link and landed on your page then the HTTP_REFERER value will be set. You can retrieve and view it on a test page like this.
if ( isset($_SERVER[ HTTP_REFERER ]) ) {
echo $_SERVER['HTTP_REFERER'];
}
Of course you might want to do something useful with this. For example, you might want to know what link a user clicked on when they broke your application.
Generating a PDF document from a web page through PHP can be problematic. It's often something that seems quite simple, but actually generating the document can be difficult and time consuming.
Reflection is used to gather more information about code during the runtime of the program. This allows code to inspect itself and to make small modifications, which is useful in a variety of situations.
PHP 8.1 comes with a few new additions to the language, and one that I have seen get the most attention is fibers. This is a feature that allows PHP code to be executed in a concurrent thread, with the ability to pause and resume that code at will.