Program in php to say “Hello World”
In this course we assume that you know the main HTML marks and some programming language, at least a little bit.
To add a PHP program within an HTML page we must, on the one hand, when creating the file, define it with a php extension (unlike static pages that have an htm or html extension) and within the content of the page, enclose the program between the symbols php [here the PHP program]?>.
The PHP command to print inside the page is called echo. Our “Hello World” program will then be:
php echo "Hello World"; ?>
In other words, the page that will be generated when the program is run will be:
As we can see, this little program is very useless, since the result of the execution of this PHP program will always be the same, that is, the text “Hello World” will be shown.