Articulos PHP
- 2.2 Ciclo FOR.
- 3 PHP junto con MySQL.
- 3.1 Conexión MySQL con enunciado die.
- 1.4 Trabajar con números en PHP.
- 1 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.8 Creando elementos con Jquery
- 3 Concatenar efectos con Jquery.
- 2.2 Introduciendo texto usando el método .text().
- 2 Añadiendo elementos a la página con append().
- 2.6 El efecto fadeIn y fadeOut.
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
- 1.6 Ordernar valores con ORDER BY.
- 2.8 Conjunción externa de tablas.
- 2.9 Insertando datos con INSERT.
- 3.7 Modificar la estructura de una tabla con ALTER TAB
- 1.7 Ordenar valores de forma descendente.
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