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
<html> | |
<head> | |
<meta charset="utf-8" /> | |
<meta name="description" content="short page description, to improve search engines"> | |
<meta name="keywords" content="short keywords, separated by comma"> | |
<title>My blog</title> | |
</head> | |
<body> | |
<h1>My first post</h1> | |
<h2>Starting HTML</h2> |
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 é igual a 9 agora e $b foi configurado como 4. | |
$a = ($b = 4) + 5; | |
// Operadores combinados | |
$a = 3; | |
$a += 5; // configura $a para 8, como se disséssemos: $a = $a + 5; | |
$b = "Bom "; |
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 | |
$welcome = "Bem vindo, "; | |
$name = "Maykon"; | |
// Concatenação | |
echo $welcome . $name; | |
$phrase = $welcome; |
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 = 10; | |
// ++ após a variável, executa a operação de incremento após a expressão | |
// Nesse caso, $c será 10 e $a será 11; | |
$c = $a++; | |
// Agora, $d e $a serão iguais, ambos terão o valor 12 | |
$d = ++$a; |
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 | |
// foo() nunca será chamada | |
$a = (false && foo()); | |
$b = (true || foo()); | |
$c = (false and foo()); | |
$d = (true or foo()); |
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 | |
$output = `ls -la`; | |
echo "<pre>$output</pre>"; | |
// <pre> é um tag HTML que formata a saída |
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 = $b = 10; | |
$name = "Maykon"; | |
$name2 = "Joselita"; | |
// Igual | |
$a == $b |
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 | |
// Soma | |
$a = 1 + 2; | |
$total = $a - 1; | |
// Total is 2 | |
// Negacão | |
$b = -$a; |
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 | |
// Define two constants | |
define('FOO', 2014); | |
define('FOO_BAR', 'Sea food'); | |
// To print a constant, we have not to use $ | |
echo FOO; |
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 | |
// Array | |
$fruits = array('Apple', 'Orange', 'Pineapple'); | |
// Array key-value | |
$data = array( | |
'first_name' => 'Maykon', |
OlderNewer