This file contains 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 'Hello World'; |
This file contains 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
# You may add here your | |
# server { | |
# ... | |
# } | |
# statements for each of your virtual hosts to this file | |
## | |
# You should look at the following URL's in order to grasp a solid understanding | |
# of Nginx configuration files in order to fully unleash the power of Nginx. | |
# http://wiki.nginx.org/Pitfalls |
This file contains 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Exercício - Loja de Tintas</title> | |
</head> | |
<body> | |
<h1>Loja de Tintas</h1> | |
<form action="tintas.php" method="POST"> | |
<label> | |
Área em M2: |
This file contains 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 sequência de Fibonacci é a seguinte: | |
1, 1, 2, 3, 5, 8, 13, 21, 34, 55, ... | |
Sua regra de formatação é simples: os dois primeiros elementos são 1; a partir de então, cada elemento é a soma dos dois anteriores. | |
Faça um algoritmo que leia um número inteiro calcule o seu número de Fibonacci. | |
F(1) = 1, F(2) = 1, F(3) = 2, F(4) = 3, etc. | |
**/ | |
function fibonacci($numero) { | |
return ($numero == 1 || $numero == 2) ? 1 : fibonacci($numero - 1) + fibonacci($numero - 2); |
This file contains 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 | |
/** | |
* Neste problema, você deverá exibir uma lista de 1 a 100, um em cada linha, com as seguintes exceções: | |
* Números divisíveis por 3 deve aparecer como 'Fizz' ao invés do número; | |
* Números divisíveis por 5 devem aparecer como 'Buzz' ao invés do número; | |
* Números divisíveis por 3 e 5 devem aparecer como 'FizzBuzz' ao invés do número'. | |
**/ | |
function isFizzbuzz($numero) | |
{ return ($numero % 3 == 0 && $numero % 5 == 0); | |
} |
This file contains 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 | |
$lista = array(12 => 2, 5 => 1); | |
$lista[] = 50; | |
$lista['x'] = 200; | |
print_r($lista); | |
/** | |
Array |
This file contains 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 | |
$numero = 30; | |
echo $numero > 20 ? 'maior que 20' : 'menor ou igual a 20'; | |
/** Output | |
maior que 20 | |
**/ |
This file contains 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 | |
$x = true; | |
$y = false; | |
$a = (50 == '50'); // true | |
$b = (50 === '50'); // false (tipo e valor) | |
$c = (50 != '50'); // false | |
$d = (50 !== '50'); // true |
This file contains 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 = 50; // decimal | |
$b = -123; // número negativo | |
$c = 0123; // octal (83 decimal) | |
$d = 0x1A; // número hexadecimal (26 decimal) | |
$e = 1.234; // ponto flutuante | |
$f = 1.2e3; // 1,2 x 1000 = 1200 |
This file contains 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
# Digitar o seguinte comando no console/cmd/ms-dos: | |
php -S localhost:8000 | |
/** Output | |
PHP 5.5.3 Development Server started at Sun May 11 11:36:43 2014 | |
Listening on http://localhost:8000 | |
Document root is /Users/jweber | |
Press Ctrl-C to quit. | |
**/ |
OlderNewer