Clase 2 de PHP
-
Upload
lismirabal -
Category
Documents
-
view
263 -
download
6
Transcript of Clase 2 de PHP
![Page 1: Clase 2 de PHP](https://reader036.fdocuments.ec/reader036/viewer/2022062405/557e8508d8b42a7e0c8b47af/html5/thumbnails/1.jpg)
ING. LISSETH AGÜERO
![Page 2: Clase 2 de PHP](https://reader036.fdocuments.ec/reader036/viewer/2022062405/557e8508d8b42a7e0c8b47af/html5/thumbnails/2.jpg)
Hay cuatro conjuntos de etiquetas que pueden ser
usadas para denotar bloques de código PHP:
1. <?php echo("si quieres servir documentos XHTML o XML\n"); ?>
PHP
ING. LISSETH AGÜERO
![Page 3: Clase 2 de PHP](https://reader036.fdocuments.ec/reader036/viewer/2022062405/557e8508d8b42a7e0c8b47af/html5/thumbnails/3.jpg)
2. <? echo ("esta es la más simple"); ?>
3. <script language="php"> echo ("muchos editores
(como FrontPage) no aceptan instrucciones de procesado");
</script>
PHP
ING. LISSETH AGÜERO
![Page 4: Clase 2 de PHP](https://reader036.fdocuments.ec/reader036/viewer/2022062405/557e8508d8b42a7e0c8b47af/html5/thumbnails/4.jpg)
4. <% echo ("Opcionalmente, puedes usar las etiquetas ASP"); %>
<%= $variable; # Esto es una abreviatura de "<% echo . . ." %>
PHP
ING. LISSETH AGÜERO
![Page 5: Clase 2 de PHP](https://reader036.fdocuments.ec/reader036/viewer/2022062405/557e8508d8b42a7e0c8b47af/html5/thumbnails/5.jpg)
PHP
EJEMPLO:
<html> <head> <title> Ejemplo basico PHP</title> </head> <body> <?php echo 'Hola mundo'; ?> </body> </html>
ING. LISSETH AGÜERO
![Page 6: Clase 2 de PHP](https://reader036.fdocuments.ec/reader036/viewer/2022062405/557e8508d8b42a7e0c8b47af/html5/thumbnails/6.jpg)
PHP
ING. LISSETH AGÜERO
![Page 7: Clase 2 de PHP](https://reader036.fdocuments.ec/reader036/viewer/2022062405/557e8508d8b42a7e0c8b47af/html5/thumbnails/7.jpg)
PHP
<html><head> <title> Ejemplo basico PHP</title> </head> <body>
<?php $ini="Hola";$fin=" a todos";$todo= $ini. $fin;echo $todo;?>
</body> </html>
ING. LISSETH AGÜERO
![Page 8: Clase 2 de PHP](https://reader036.fdocuments.ec/reader036/viewer/2022062405/557e8508d8b42a7e0c8b47af/html5/thumbnails/8.jpg)
PHP
ING. LISSETH AGÜERO
EJEMPLO NOMBRE RESULTADO
$a + $b Suma Suma de a y b (a+b)
$a - $b Resta Diferencia entre a y b (a-b)
$a * $b Multiplicación Producto de a y b (axb)
$a / $b División Cociente entre a y b (a÷b)
![Page 9: Clase 2 de PHP](https://reader036.fdocuments.ec/reader036/viewer/2022062405/557e8508d8b42a7e0c8b47af/html5/thumbnails/9.jpg)
PHP
<html><head> <title> Ejemplo basico PHP</title> </head> <body>
<?php $n1=1;$n2= 2;$suma= $n1 + $n2;echo $suma;?>
</body> </html>
ING. LISSETH AGÜERO
![Page 10: Clase 2 de PHP](https://reader036.fdocuments.ec/reader036/viewer/2022062405/557e8508d8b42a7e0c8b47af/html5/thumbnails/10.jpg)
PHP
ING. LISSETH AGÜERO
EJEMPLO NOMBRE RESULTADO
$a == $b Igualdad Cierto si a es igual a b
$a =! $b Diferencia Cierto si a no es igual a b
$a < $b Menor que Cierto si a es menor a b
$a > $b Mayor que Cierto si a es mayor a b
$a<=$b Menor igual que Cierto si a es menor igual a b
$a>=$b Mayor igual que Cierto si a es mayor igual a b
![Page 11: Clase 2 de PHP](https://reader036.fdocuments.ec/reader036/viewer/2022062405/557e8508d8b42a7e0c8b47af/html5/thumbnails/11.jpg)
PHP
ING. LISSETH AGÜERO
EJEMPLO NOMBRE RESULTADO
++$a Preincremento Incrementa $a en uno y después devuelve $a.
$a ++ Postincremento Devuelve $a y después incrementa $a en uno.
-- $a Predecremento Decrementa $a en uno y después devuelve $a.
$a -- Postdecremento Devuelve $a y después decrementa $a en uno.
![Page 12: Clase 2 de PHP](https://reader036.fdocuments.ec/reader036/viewer/2022062405/557e8508d8b42a7e0c8b47af/html5/thumbnails/12.jpg)
PHP
<html><head> <title> Ejemplo basico PHP</title> </head> <body>
<?phpecho "<h3>Postincremento</h3>";$a = 5;echo "Deberia ser 5: " . $a++ . "<br>\n";echo "Deberia ser 6: " . $a . "<br>\n";?>
</body> </html>
ING. LISSETH AGÜERO