miércoles, 2 de enero de 2013

Ejercicio 5.4.php


<?php
/*
Author: Andrea Rubio Mesa
Date: 02/01/2013
Descripcion: Operadores Aritmeticos PARTE II                           
Ultima modificacion: 
*/
?>
<html>
<head><title>Operadores Aritmeticos</title></head>
<body bgcolor="#99ff66">
<h2>Shortcut Operadores</h2>
<font size="+1">
<?php
  //Usando Shortcuts
   $num=10;
  Print "10 es asignado a \$num. <br>";
  
  $num += 2;
  Print "\$num += 2; \$num es $num <br>";
  
  $num -= 1;
  Print "\$num -= 1; \$num es $num <br>";
  
  $num *= 3;
  Print "\$num *= 3; \$num es $num <br>";
?>
</body>
</html>   
  

Ejercicio 5.3.php


<?php
/*
Author: Andrea Rubio Mesa
Date: 02/01/2013
Descripcion:                            
Ultima modificacion: 
*/
?>
<html>
<head><title>Operadores Aritmeticos</title></head>
<body bgcolor="#ccccff" text="000033">
<h2>Operadores Aritmeticos</h2>
<p>
<?php
 $num1 = 5;
 $num2 = 7;
 $result = $num1 + $num2;
 print "<h3>$result = $num1 + $num2 <br>";
 $result = $result + (10/2 + 5) /2;
 print "$result = 12 + (10 / 2 + 5) /2 <br></h3>";
?>
</body>
</html> 

Ejercicio 5.2.php


<?php
/*
Author: Andrea Rubio Mesa
Date: 02/01/2013
Descripcion: Uso parentesis y asociatividad Parte I           
Ultima modificacion: 
*/
?>
<html>
<head><title>Parentesis y Asociatividad</title>
</head>
<body bgcolor="lightgreen">
<font face="arial" size='+1'>
<?php
 $resultado =5 + 4 * 12 / 4;
  print "$resultado = 5 + 4 + 12 / 4";
 $result = (5 + 4) * (12 / 4);
 print "<br>$result = (5 + 4)* (12 / 4)  ";
 ?>
</body>
</html>

Ejercicio 5.1.php


<?php
/*
Author: Andrea Rubio Mesa
Date: 02/01/2013
Descripcion: Uso parentesis y asociatividad Parte I           
Ultima modificacion: 
*/
?>
<html>
<head><title>Parentesis y Asociatividad</title>
</head>
<body bgcolor="lightgreen">
<font face="arial" size="+1">
<?php
 $resultado =5 + 4 * 12 / 4;
 print "$resultado = 5 + 4 + 12 / 4";
 $result = (5 + 4) * 12 / (4 - 2);
 print "<br>$result = (5 + 4) * 12 / (4 - 2) ";
 ?>
</body>
</html>

Apuntes : Expresiones Y Operadores


◊ Expresiones Y Operadores:

• Operadores Aritméticos:
+,-,*,/,%,++;--

• Operadores de Asignación:
=

• Operadores combinados: =, += , etc.
$a = 3; $a +=5; → a vale 8
$b = “hola”; $b = “mundo”; → b vale “ Hola mundo”
→ Equivale a $b = $b . “mundo”;

• Operadores de comparación:
==,|=,<,>,<=,>= y otros.

• Operador de control de error: @: Antepuesto a una expresión, evita cualquier mensaje de error que pueda ser generado por la expresión.

• Operadores Lógicos:
And (&&),or (ll),l,xor
And/&& y or/ll tienen diferentes prioridades.

• Operadores de cadena:
Concatenación . ( Punto )
Asignación con concatenación: .=

• Precedencia de operadores (de mayor a menor):
++;--
*,/,%
+,-
<; <= , >, >=
==, !=
&&
||
And
or

Ejercicio 4.24.php


<?php
/*
Author: Andrea Rubio Mesa
Date: 02/01/2013
Descripcion: Uso de los formularios simples con el metodo POST
               es llamado desde 4.23.html            
Ultima modificacion: 
*/
?>
<html>
<head><title>Processing First Form</title>
</head>
<body bgcolor="lightgreen"><font size="+1">
<h2>Estos son los resultados de la consulta:</h2>
<?php
 extract($_REQUEST, EXTR_SKIP); //Extrayendo los imputs del formulario
 print "Bienvenido al site ET Crea-Tic $tu_nombre<br>"; //Registro global
 print "Puedo llamarte al $tu_telefono<br>";
print "Te enviare un correo a $tu_email<br>";
?>
</body>
</html>

Ejercicio 4.23.html


<?php
/*
Author: Andrea Rubio Mesa
Date: 21/12/2012
Descripcion: Uso de los formularios simples con el metodo POST
Ultima modificacion: 
*/
?>
<html>
<head><title>Primer formulario en HTML</title>
</head>
<body bgcolor="lightblue"><font size="+1">
 <form action="http://localhost/AndreitaRubio/Ejercicios/4.24.php" method="POST">
  <p>
 Por favor introduzca su nombre: <br>
  <input type="text" size=50 name="tu_nombre"> <br>
  Por favor introduzca su numero de telefono: <br>
  <input type="text" size=50 name="tu_telefono"> <br>
  Por favor introduzca su correo electronico: <br>
  <input type="text" size=50 name="tu_email"> <br>
  <p>
  <input type=submit value="Enviar">
  <input type=reset value="borrar">
 </form>
 <br>
 </body>
 </html>