Articulos PHP
- 1.8 Arreglos o array.
- 2.1 Enunciado switch.
- 1.1 Variables en PHP
- 1.4 Trabajar con números en PHP.
- 3.4 Usando extract con MySQL.
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
- 3.1 Callback en Jquery
- 1.4 El evento click
- 2.6 El efecto fadeIn y fadeOut.
- 2.9 Valor de un campo de texto con attr().
- 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.1 Como incluir estilos en una página web.
- 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
- 3.4 Creando una tabla con CREATE TABLE.
- 3.9 Privilegios o permisos en MySQL
- 1.4 Obtener el valor más pequeño de una columna.
- 4.1 Eliminando privilegios de una cuenta.
- 1 MySQL.
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



