The PHP script engine parses PHP code and converts it to HTML that is sent to the user's browser. When a PHP page is requested, the web server passes it to the PHP script engine. The engine then executes the PHP script, which can make database queries or echo text. It outputs the results as HTML that is returned to the web server and sent to the user.