⊗ppPmBsRn 3 of 447 menu

PHP Code Execution

Let's assume you already have a PHP server installed. In it, your programs will be located in files with the extension php. These files are actually just regular HTML files in which we can write the HTML code of our pages, like this:

<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>My first program</title> </head> <body> my first program </body> </html>

In these files, right inside the HTML code, we can write PHP code. It is written in special brackets:

<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>My first program</title> </head> <body> <?php echo 'my first program'; ?> </body> </html>

If you run this file through a PHP server, the server will execute the PHP commands and send the result to the browser. The command echo, which you can see there, simply performs the output of the specified string. As a result, only the HTML code will be sent to the browser, and instead of the PHP code there will be the result of its execution.

For simplicity, at the learning stage, extra tags can be omitted:

<?php echo 'my first program'; ?>
English
AfrikaansAzərbaycanБългарскиবাংলাБеларускаяČeštinaDanskDeutschΕλληνικάEspañolEestiSuomiFrançaisहिन्दीMagyarՀայերենIndonesiaItaliano日本語ქართულიҚазақ한국어КыргызчаLietuviųLatviešuМакедонскиMelayuမြန်မာNederlandsNorskPolskiPortuguêsRomânăРусскийසිංහලSlovenčinaSlovenščinaShqipСрпскиSrpskiSvenskaKiswahiliТоҷикӣไทยTürkmenTürkçeЎзбекOʻzbekTiếng Việt
We use cookies for website operation, analytics, and personalization. Data processing is carried out in accordance with the Privacy Policy.
accept all customize decline