Examen 1
Examen 1
PREGUNTAS:............................................................................................................................... 2
1.¿QUÉ ES PHP?....................................................................................................................2
2. Diferencia entre el lenguaje de programación del cliente y programador........................... 2
3. Tipos de pag en php............................................................................................................ 2
4. En HTML existen los bloque y líneas, como:.......................................................................2
5. POO:....................................................................................................................................2
6. Fundamentos de POO:........................................................................................................2
CÓDIGO:....................................................................................................................................... 3
EJERCICIO 1:..........................................................................................................................3
INDEX......................................................................................................................................4
AVIONCITO(SEMANA 2):........................................................................................................5
CÍRCULO.................................................................................................................................6
OPERACIÓN EJERCICIO....................................................................................................... 7
CENTRAR,IZQUIERDA,DERECHA........................................................................................ 9
COMANDOS............................................................................................................................... 10
ANEXOS......................................................................................................................................10
LINKS.......................................................................................................................................... 15
PREGUNTAS:
1.¿QUÉ ES PHP?
PHP (Hypertext Preprocessor): Procesador de Hipertexto
5. POO:
6. Fundamentos de POO:
1. Abstracción: hacer una clase enfocada a su objetivo
2. Encapsulamiento: definición de métodos privados
3. Herencia: reutilización de atributos de una clase padre a sus hijos
4. Polimorfismo: nos da la opción de cambiar cierto métodos heredados del padre y
aquellos que no queremos cambiar se colocan en priv
7.HTML
Lenguaje de marcas de hipertexto
8. Que significa: <!DOCTYPE html>
Da a conocer la versión de html que estamos usando
CÓDIGO:
EJERCICIO 1:
<?php
echo "<h1>$resultado</h1>";
}
convert(25);
?>
<script>
function convert(grade) {
resultado = (grade * 9/5) + 32;
console.log(resultado);
}
convert(25);
</script>
INDEX
<?php
$x = 5;
// header('Location: test.php');
class CabeceraDePagina
{
function __construct(
public string $text_color = '#fff',
public string $background = 'blue',
public string $align = 'left'
) {}
echo "<h1
style='
background-color: $this->background;
color: $this->text_color;
text-align: $this->align;
'
>Text example</h1>";
}
}
$cabecera2->render();
$cabecera->render();
AVIONCITO(SEMANA 2):
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<style>
img {
cursor: pointer;
}
</style>
<style>
#flyjet {
width: 40px;
height: 24px;
transition: all 3s;
}
#flyjet.growing {
width: 400px;
height: 240px;
}
</style>
</head>
<body>
<script>
let ended = false; // cambiará a true cuando la animación finalice
flyjet.onclick = function() {
flyjet.addEventListener('transitionend', function() {
if (!ended) { // verificación para que el mensaje solo se muestre una
vez
ended = true;
alert('Done!');
}
});
flyjet.classList.add('growing');
}
</script>
</body>
</html>
CÍRCULO
<html>
<head>
<meta charset="utf-8">
<style>
.message-ball {
font-size: 20px;
line-height: 200px;
text-align: center;
}
.circle{
transition-property: width,height;
transition-duration: 2s;
position: fixed;
transform: translateX(-50%) translateY(-50%);
background-color: red;
border-radius: 50%;
}
</style>
</head>
<body>
<button onclick="go()">Pruebame</button>
<script>
function go(){
showCircle(150,150,100,div => {
div.classList.add('message-ball');
div.append("Hola, mundo!");
});
}
function showCircle(cx,cy,radius,callback){
let div = document.createElement('div');
div.style.width=0;
div.style.height=0;
div.style.left=cx+'px';
div.style.top= cy+ 'px';
div.className= 'circle';
document.body.append(div);
setTimeout(() =>{
div.style.width=radius * 2+ 'px';
div.style.height = radius * 2 +'px';
div.addEventListener('transitionend', function
handler(){
div.removeEventListener('transitionend', handler);
callback(div);
});
}, 0);
}
</script>
</body>
</html>
OPERACIÓN EJERCICIO
<?php
class Operacion
{
public function suma($a, $b)
{
return $a + $b;
}
CENTRAR,IZQUIERDA,DERECHA
<?php
class CabeceraPagina {
function __construct(
public $align
) {}
function render() {
echo "<h1 align=$this->align>Hola mundo</h1>";
}
}
ANEXOS
LINKS
1. https://cssreference.io/
2. https://www.w3schools.com/css/
3. https://axarnet.es/blog/que-es-utf8
4. https://axarnet.es/blog/que-es-utf8