image


Valora:  2.5/5
Inicio » PHP » PHP Tutorial » Basic concepts




Our first PHP

The advantage that PHP offers over other programming languages that run on the server (such as script CGI Perl) is that it allows us to insert the PHP sentences in the HTML pages- a complicated concept if you have never studied the process of how a PHP or ASP page works.

Here is a simple example for a better understanding. The HTML code is in blue and the PHP code in red. We will use this criterion throughout the entire manual.

<!-- PHP Tutorial WebEstilo.com -->
<html>
<head>
   <title>PHP Example</title>
</head>

<body>

HTML part
<BR><BR>

<?php
   echo "PHP part<br>";
   
   for($i=0;$i<10;$i++)
   {
      echo "Line ".$i."<br>";
   }
?>


</body>
</html>

Execute View code

The PHP code run comprises two parts: the first one prints "PHP Section", and the second part is a loop that runs 10 times from 0 to 9; every time it is run, a row is written, the variable $i is the row number being written.

It is not important if the sample program is not completely understood, it is being used only to illustrate how the HTML and PHP codes are interspersed.






WebEstilo.com - Introduzca su e-mail y conozca las novedades. No hacemos Spam.
Google
  Web WebEstilo.com   
 
Valid HTML 4.01!
Última modificación:24 de Diciembre de 2004. Spain - España.
© 1998-2004 por Joaquin Gracia. Todos los derechos reservados.