Un problema sencillo que se nos puede presentar y que no se puede resolver empleando solo HTML es que una página esté disponible sólo los 10 primeros días del mes.
$dia=date("d");
A las variables en PHP se les antecede el caracter $.
Si a la función date le pasamos el string "d" retornará
sólo el día (si queremos la fecha completa: $fecha=date("d/m/Y")
Para verificar si la variable $dia
es menor o igual a 10, debemos emplear la instrucción if, similar a otros lenguajes.
Entonces la página con el programa queda de la siguiente forma:
Un programita más útil que "Hola Mundo"
p><html>
<head></head>
<body>
<p><?php
$dia = date("d");
if($dia<=10){
echo"sitio activo";
}
else{
echo"sitio fuera de servicio";
}
?></p>
<p></body>
</html></p>
localhost/curso/pagina2.php
C, C++, Java
tenemos por costumbre escribir las palabras claves en minúsculas, pero esto es solo por costumbre.if
debe ir obligatoriamente entre paréntesis.
Los operadores relacionales disponibles son:> Mayor
>= Mayor o igual
< Menor
<= Menor o igual
== Igual
!= Distinto
else
Hi! I am a robot. I just upvoted you! I found similar content that readers might be interested in:
http://www.webmasterworkers.info/posts/php/60/Un-programita-mas-util-que-Hola-Mundo-.html
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
Hola este es el tipo de contenido que voy buscando, te sigo. A ver si hacemos comunidad.
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
hola amigo muchas gracias dia a dia voy subiendo me gusta compartir lo que aprendo
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
Muy buen contenido!
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
Muchas gracias amigo es con todo gusto
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
This post has been ranked within the top 50 most undervalued posts in the first half of Aug 10. We estimate that this post is undervalued by $18.24 as compared to a scenario in which every voter had an equal say.
See the full rankings and details in The Daily Tribune: Aug 10 - Part I. You can also read about some of our methodology, data analysis and technical details in our initial post.
If you are the author and would prefer not to receive these comments, simply reply "Stop" to this comment.
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
Congratulations! This post has been upvoted from the communal account, @minnowsupport, by LOGAN6230 from the Minnow Support Project. It's a witness project run by aggroed, ausbitbank, teamsteem, theprophet0, someguy123, neoxian, followbtcnews/crimsonclad, and netuoso. The goal is to help Steemit grow by supporting Minnows and creating a social network. Please find us in the Peace, Abundance, and Liberty Network (PALnet) Discord Channel. It's a completely public and open space to all members of the Steemit community who voluntarily choose to be there.
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
This post has received a 5.47 % upvote from @bellyrub thanks to: @logan6230.
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit