lunes, 4 de mayo de 2020

Primeros Ejercicios de PHP

Ej 1:
<?php
echo "Hola Mundo, estudiantes de taller";
?>
Ej 2:
<!DOCTYPE html>
<html lang="en">
<head>
<title>Primera Pagina en PHP de Taller de Sistemas</title>
</head>
<body>
<?php
echo "Primera Pagina en PHP -Taller de Sistemas";
?>
</body>
</html>
Ej 3:
<?php
$name = "Daniel Mateo";
$age = 15;
$single = TRUE;
?>
Ej 4.1:
<?php
$a = 2;
$b = 3;
echo $a + $b;
?>
Ej 4.2:
<?php
$a = 2;
$b = "3";
echo $a + $b;
?>
Ej 4.3:
<?php
$a = 2;
$b = "3a";
echo $a + $b;
?>
Ej 4.4:
<?php
$a = 2;
$b = "a3";
echo $a + $b;
?>
Ej 5:
<?php
$a = 5;
function prueba(){
echo $a;
}
prueba();
?>
Ej 6:
<?php
$a = 5;
$b = 10;
function myTest(){
global $a, $b;
$b = $a + $b;
}
myTest();
echo $b;
?>
Ej 7:
<?php
$a=5;
$b=10;
function myTest(){
$GLOBALS["b"] = $GLOBALS["a"] + $GLOBALS["b"];
}
myTest();
echo $b;
?>
Ej 8:
<?php
function foo(){
static $index = 0;
$index++;
echo "$index\n";
}
foo();
foo();
?>
Ej 9:
<?php
//Comentario
#Comentario x2
/*Comentario
por 3
*/
?>
Ej 10:
<?php
define("pi",3.141592)
echo pi;
define("say_hello","Hola Mundo",true)
echo say_hello;
?>

No hay comentarios.:

Publicar un comentario