PHP Basics

The basic function of PHP is to interpret a script to produce a Web page that is sent to a client. The script typically contains a mix of HTML that is sent literally to the client and PHP code that is executed as a program. Whatever output the code produces is sent to the client, so the client never sees the code; it sees only the resulting output.

When PHP begins reading a file, it simply copies whatever it finds there to the output, with the assumption that the contents of the file represent literal HTML. When the PHP interpreter encounters a special opening tag, it switches from HTML mode to PHP code mode and starts interpreting the file as PHP code to be executed. The end of the code is indicated by another special tag, at which ...

Get MySQL now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.