Capitolo 1. Introduction

Sommario
Che cosa è il PHP?
What can PHP do?
A brief history of PHP

Che cosa è il PHP?

PHP (ufficialmente "PHP: Hypertext Preprocessor") è un linguaggio di scripting lato server immerso nel HTML.

Risposta banale, ma che cosa significa? Un esempio:

Esempio 1-1. Un esempio introduttivo


<html>
    <head>
        <title>Esempio</title>
    </head>
    <body>
        <?php echo "Ciao, sono uno script PHP!"; ?>
    </body>
</html>
     

Notate come questo esempio è differente da uno script CGI scritto in altri linguaggi tipo Perl o C -- invece di scrivere un programma con parecchi comandi per produrre HTML, si scrive in HTML con qualche comando immerso per ottenere dei risultati (in questo semplice esempio, la visualizzazione di una frase). Il codice PHP è delimitato da speciali tagche ne indicano l'inizio e la fine e che consentono di passare dal modo HTML al modo PHP.

What distinguishes PHP from something like client-side Javascript is that the code is executed on the server. If you were to have a script similar to the above on your server, the client would receive the results of running that script, with no way of determining what the underlying code may be. You can even configure your web server to process all your HTML files with PHP, and then there's really no way that users can tell what you have up your sleeve.