Curso de PHP🐘 y MySql🐬 [12.- Operador de fusión]
En este tutorial vamos a aprender a usar el operador de fusion que nos ofrece php7.
Codigo: https://github.com/programadornovato/php/commit/877875f39c9aa0c817615e8b7eed2b1c4dbcb8dc
< meta name= "viewport" content= "width=device-width, initial-scale=1.0" >
< link rel= "stylesheet" href= "https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity= "sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin= "anonymous" >
< meta http-equiv= "X-UA-Compatible" content= "ie=edge" >
< title > Tutorial Operador de fusion < /title >
< div class = "container mt-2" >
< div class = "alert alert-primary" role= "alert" >
¡¡¡Humano da click en tu edad!!!
< div class = "btn-group" role= "group" aria-label= "Basic example" >
< button type= "submit" name= "edad" class = "btn btn-secondary" value= "16" > 16 < /button >
< button type= "submit" name= "edad" class = "btn btn-secondary" value= "17" > 17 < /button >
< button type= "submit" name= "edad" class = "btn btn-secondary" value= "18" > 18 < /button >
< button type= "submit" name= "edad" class = "btn btn-secondary" value= "19" > 19 < /button >
if(isset($_GET["edad"])==true){
$edad=$_GET [ "edad" ] ?? 0 ;
echo "¡¡¡Humano tonto, selecciona tu edad!!!" ;
else if ( $edad > 0 && $edad < 18 ){
echo "Eres un humano menor de edad" ;
echo "Eres un humano mayor de edad" ;
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Tutorial Operador de fusion</title>
</head>
<body>
<form>
<div class="container mt-2">
<div class="alert alert-primary" role="alert">
¡¡¡Humano da click en tu edad!!!
</div>
<div class="btn-group" role="group" aria-label="Basic example">
<button type="submit" name="edad" class="btn btn-secondary" value="16">16</button>
<button type="submit" name="edad" class="btn btn-secondary" value="17">17</button>
<button type="submit" name="edad" class="btn btn-secondary" value="18">18</button>
<button type="submit" name="edad" class="btn btn-secondary" value="19">19</button>
</div>
</div>
</form>
<?php
/*
if(isset($_GET["edad"])==true){
if($_GET["edad"]!=null){
$edad=$_GET["edad"];
}
}else{
$edad=0;
}
*/
$edad=$_GET["edad"] ?? 0 ;
if($edad==0){
echo "¡¡¡Humano tonto, selecciona tu edad!!!";
}
else if($edad>0 && $edad<18){
echo "Eres un humano menor de edad";
}
else if($edad>=18){
echo "Eres un humano mayor de edad";
}
?>
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Tutorial Operador de fusion</title>
</head>
<body>
<form>
<div class="container mt-2">
<div class="alert alert-primary" role="alert">
¡¡¡Humano da click en tu edad!!!
</div>
<div class="btn-group" role="group" aria-label="Basic example">
<button type="submit" name="edad" class="btn btn-secondary" value="16">16</button>
<button type="submit" name="edad" class="btn btn-secondary" value="17">17</button>
<button type="submit" name="edad" class="btn btn-secondary" value="18">18</button>
<button type="submit" name="edad" class="btn btn-secondary" value="19">19</button>
</div>
</div>
</form>
<?php
/*
if(isset($_GET["edad"])==true){
if($_GET["edad"]!=null){
$edad=$_GET["edad"];
}
}else{
$edad=0;
}
*/
$edad=$_GET["edad"] ?? 0 ;
if($edad==0){
echo "¡¡¡Humano tonto, selecciona tu edad!!!";
}
else if($edad>0 && $edad<18){
echo "Eres un humano menor de edad";
}
else if($edad>=18){
echo "Eres un humano mayor de edad";
}
?>
</body>
</html>
VIDEO
? Esta lista de reproducción: https://www.youtube.com/playlist?list=PLCTD_CpMeEKS2Dvb-WNrAuDAXObB8GzJ0
Codigos en gdrive: https://drive.google.com/file/d/1tQwYvfL2jiUFc6beTWkOkGmXkq5zzFw2/view?usp=sharing Gracias por apoyar este canal: https://www.patreon.com/programadornovato?fan_landing=true
? Facebook: https://facebook.com/ProgramadorNovatoOficial ? Twitter: https://twitter.com/programadornova ? Linkedin: https://www.linkedin.com/in/programadornovato/ ? Instagram: https://www.instagram.com/programadornovato/