Documentos de Académico
Documentos de Profesional
Documentos de Cultura
• INTERPRETADO
• EMBEBIDO EN HTML
• LENGUAJE DE SCRIPT
<?php
echo "Hola";
?>
• MANEJAR COOKIES
• EXTENSIONES .PHP
• SERVIDOR PHP
• LENGUAJE INTERPRETADO
• <script language="php">
echo (“empleando lenguaje de script");
</script>
• <?php
if ($condicion) {
?>
<strong>Se cumplio la condicion.</strong>
<?php
} else {
?>
<strong>No se cumplio la condicion.</strong>
<?php
}
?>
• SEPARACIÓN “;”
• SINTÁXIS HEREDOC
$str = <<<TAG
Ejemplo con un string de varias líneas
linea
TAG;
• $<VAR>
• <?php
$g1 = 1;
$g2 = 2;
function f1() {
global $g1, $g2;
static $a = 0 // NO PIERDE EL VALOR
f1();
echo $g2; ?>
• gettype()
• is_array()
• is_float()
• is_int()
• is_object()
• is_string()
• define()
• NO SE UTILIZA EL PREFIJO $
• define(<CONSTANTE>, <VALOR>);
• ASIGNACION =
• if (<condicion>) {
<bloque de instrucciones>
}
• if (<condicion>) {
<bloque 1>
}
else {
<bloque 2>
}
• if (<condicion1>) {
<bloque 1>
}
elseif (<condicion2>) {
<bloque2>
}
else {
}
• switch ($<var>) {
case <caso0>:
<bloque instrucciones>
break;
case <caso1>:
<bloque instrucciones>
break;
case <caso2>:
<bloque instrucciones>
break;
}
• while (<condicion>) {
<bloque instrucciones>
}
• do {
<bloque instrucciones>
} while (<condicion>)
foreach(expresionMatriz as $valor) {
instruccion1;
….
instruccionn;
}
• CLIENTE SERVIDOR
• CGI SCRIPTS
• phpinfo()
•$funcion = ‘<nombre>';
$func(); // ejecuta la función con nombre
<nombre>
<?php
echo preg_replace_callback('~-([a-z])~',
function ($coincidencia) {
return strtoupper($coincidencia[1]);
}, 'hola-mundo');
// imprime holaMundo
?>