This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
#Ejercicio para determinar si un alumno aprobo una materia considerando que el minimo aprobatorio es 6.0 | |
$calificacion = 6.1; | |
if ($calificacion >= 6) { | |
echo "Materia aprobada"; | |
}else{ | |
echo "Materia reprobada"; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$edad = 18; | |
if ($edad >= 18) { | |
echo "Es mayor de edad"; | |
} else { | |
echo "Es menor de edad"; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
goto segundaSeccion; | |
echo "Esta es la primera seccion"; | |
segundaSeccion: | |
echo "Esta es la segunda seccion"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
echo $variable; | |
function mostrarMensaje(){ | |
echo "la siguiente cadena solo se puede imprimir dentro de la función mostrarMensaje <br>"; | |
include_once "archivo.php"; | |
echo $variable; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$variable = "Soy una variable dentro de un archivo incluido"; | |
?> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require "archivo.php"; | |
echo "Esto se imprime después de incluir un archivo con require"; | |
/** Resultado: | |
* | |
* Texto de un archivo diferente |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
echo "Texto de un archivo diferente <br>"; | |
?> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function sumar($numero1, $numero2){ | |
return $numero1 + $numero2; | |
} | |
echo sumar(5,8); | |
/** Resultado: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function escribir(){ | |
echo "Hola <br>"; | |
} | |
register_tick_function("escribir"); | |
$i = 0; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$a=8; | |
$x=10; | |
$y=8; | |
$z=5; | |
$resultado = match ($a) { | |
$x => '$a vale igual que $x', |