Why this code instead of foo prints the following two lines (even here):

<html> <body> <?php echo "<p>foo</p>"; ?> </body> </html> 

PHP for the first time I see, and an example is copy-paste from wikipedia.

 <html> <body> <?php echo "<p>foo</p>"; ?> </body> </html> 
  • Tags removed, remainder is. To run PHP need an interpreter, as it were. - user207618
  • And what is the file extension of your file? - koks_rs
  • "Even here" is displayed incorrectly because the piece of code you inserted was not properly formatted in the markdown format. For this, the editor has a button {} - VenZell
  • Denver I put. And in index.html it contributed. Need something else to put? - vamireh
  • The file must be in * .php format and must be placed on a php server - HELO WORD

1 answer 1

Because php is a server language. You must first install the server on your computer and then open your files that are located in the server's special folder through the browser.

Read about how php works and how to install a local server, for example, here or here

  • Not a server script but a script (although the interpreter is usually on the server)! The server is only required to access from the browser. Since version 5.4, server has been built into PCP. - E_p