Articulos PHP
- 1.2 Enunciados de salida echo.
- 2.3 Ciclo FOR avanzado.
- 2.9 Fecha y Hora en PHP.
- 1.4 Trabajar con números en PHP.
- 3.2 Obteniendo información de la base de datos.
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
- 2.6 El efecto fadeIn y fadeOut.
- 3.1 Callback en Jquery
- 2.7 Listas desplegables con change()
- 1.2 Usar CDN para utilizar Jquery
- 1.5 El evento keypress
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.2 Estructura de los estilos CSS.
- 1 Hojas de estilo 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
- 3.2 Tipos de datos en MySQL.
- 1.3 Valor más alto de una columna.
- 1.8 Seleccionando registros con WHERE.
- 3.8 Cuentas de usuario MySQL
- 2.8 Conjunción externa de tablas.
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



