Articulos PHP
- 1.2 Enunciados de salida echo.
- 2.1 Enunciado switch.
- 1.6 Unir comparaciones.
- 2.5 Saliendo del ciclo con BREAK.
- 2.4 Ciclo WHILE.
Warning: Use of undefined constant php - assumed 'php' (this will throw an Error in a future version of PHP) in /home/vhosts/lawebderay.orgfree.com/articulos.php on line 128
Articulos Jquery
- 1.9 El elemento on.
- 1.5 El evento keypress
- 2 Añadiendo elementos a la página con append().
- 2.9 Valor de un campo de texto con attr().
- 2.3 Pasando el cursor sobre un elemento.
Warning: Use of undefined constant jquery - assumed 'jquery' (this will throw an Error in a future version of PHP) in /home/vhosts/lawebderay.orgfree.com/articulos.php on line 137
Articulos CSS
- 1.1 Como incluir estilos en una página web.
- 1 Hojas de estilo CSS.
- 1.2 Estructura de los estilos CSS.
Warning: Use of undefined constant css - assumed 'css' (this will throw an Error in a future version of PHP) in /home/vhosts/lawebderay.orgfree.com/articulos.php on line 146
Articulos Mysql
- 2.4 Seleccionando filas con LIKE y WHERE
- 1.5 Realizar una suma con SUM()
- 2.1 Seleccionando registros con BETWEEN y WHERE
- 1.6 Ordernar valores con ORDER BY.
- 4.1 Eliminando privilegios de una cuenta.
Warning: Use of undefined constant mysql - assumed 'mysql' (this will throw an Error in a future version of PHP) in /home/vhosts/lawebderay.orgfree.com/articulos.php on line 155
Warning: Use of undefined constant tema - assumed 'tema' (this will throw an Error in a future version of PHP) in /home/vhosts/lawebderay.orgfree.com/articulos.php on line 199
Warning: Use of undefined constant tema - assumed 'tema' (this will throw an Error in a future version of PHP) in /home/vhosts/lawebderay.orgfree.com/articulos.php on line 220
Warning: Use of undefined constant id - assumed 'id' (this will throw an Error in a future version of PHP) in /home/vhosts/lawebderay.orgfree.com/articulos.php on line 220
3.3 Transformando series en variables con extract();
En algunas situaciones será útil transformar los elementos de un array o arreglo en variables, es decir, guardar los valores de un arreglo en variables que tengan como nombre la clave del elemento. Entonces para entender un poco mejor, supongamos que tenemos el siguiente arreglo:
$frutas=array("almibar"=>"piña","mermelada"=>"fresa","jugo"=>"naranja","ensalada"=>"kiwi");
Y queremos que los valores de cada elemento del array se guarden en variables cuyo nombre sea igual a la clave del elemento del array. Entonces usamos extract():
extract($frutas);
De forma que ahora se han creado las variables $almibar=”piña”, $mermelada=”fresa”, $jugo=”naranja” y $ensalada=”kiwi”.
Ya para terminar, supongamos que tenemos el siguiente código:
<?php
$frutas=array("almibar"=>"piña","mermelada"=>"fresa","jugo"=>"naranja","ensalada"=>"kiwi");
extract($frutas);
echo "<br/>Para la mermelada se usa la $mermelada y para el jugo se usa $jugo";
?>
Entonces el output serÃa el siguiente:
Para la mermelada se usa la fresa y para el jugo se usa naranja
Warning: Use of undefined constant tema - assumed 'tema' (this will throw an Error in a future version of PHP) in /home/vhosts/lawebderay.orgfree.com/articulos.php on line 225
Transformando series en variables.
Warning: Use of undefined constant id - assumed 'id' (this will throw an Error in a future version of PHP) in /home/vhosts/lawebderay.orgfree.com/articulos.php on line 225
3.3



