Articulos PHP
- 2.7 Enlazar un programas con include.
- 2.2 Ciclo FOR.
- 1.6 Unir comparaciones.
- 1.5 Hacer comparaciones de valores.
- 1.4 Trabajar con números en PHP.
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.5 El evento keypress
- 2.8 Valor de una lista desplegable con attr().
- 1.9 El elemento on.
- 2.5 Recorriendo el array con each().
- 2.7 Listas desplegables con change()
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 Hojas de estilo CSS.
- 1.2 Estructura de los estilos CSS.
- 1.1 Como incluir estilos en una página web.
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 Actualizar valores con UPDATE.
- 1 MySQL.
- 3.1 Borrando una fila con DELETE.
- 2.6 Combinando resultados con UNION ALL.
- 1.2 Función AVG().
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