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><?php print "Titulo da pagina" ?></title> | |
</head> | |
<body> | |
<?= "conteúdo do site" ?> | |
</body> | |
</html> |
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>Titulo da pagina</title> | |
</head> | |
<body> | |
conteúdo do site | |
</body> | |
</html> |
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 | |
$variael = "texto qualquer"; | |
print "variável: $variavel"; // variável: texto qualquer | |
print 'variável: $variavel'; // variável: $variavel |
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 | |
$variavel = "texto qualquer"; | |
print "variável: {$variavel}"; // variável: texto qualquer | |
print 'variável: {$variavel}'; // variável: {$variavel} |
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 | |
$string_1 = "texto"; | |
$string_2 = " qualquer"; | |
function funcao(){ return 'texto' . " qualquer"; } | |
print $string_1 . $string_2; // texto qualquer | |
print "texto" . $string_2; // texto qualquer | |
print "texto" . " qualquer"; // texto qualquer | |
print "retorno: " . funcao(); // retorno: texto qualquer |
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 'Isto é um teste'; // Estilo de comentário de uma linha em c++ | |
/* Este é um comentário de múltiplas linhas | |
ainda outra linha de comentário */ | |
echo 'Isto ainda é outro teste'; | |
echo 'Teste final'; # Este é um comentário de uma linha no estilo shell |
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 'Isto é um teste'; /* Este comentário irá causar um problema */ | |
*/ |
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 | |
interface ZCE { | |
# bloco de código | |
} | |
class Programador implements ZCE { | |
# bloco de código | |
} |
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 foreach(['Alef', 'Sara', 'Liana'] as $nome): ?> | |
<usuario nome="<?php print $nome ?>" /> | |
<?php endforeach; ?> |
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 | |
header("Content-type: text/xml"); | |
// Cabeçalho XML | |
print "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"; | |
// Abrindo tag que contém a lista de usuários | |
print "<lista-usuarios>"; | |
// repare que está sendo incluindo um arquivo do tipo XML com código PHP dentro. | |
require_once 'syntax-example-8.xml'; | |
// Fechando tag que contém a lista de usuários |
OlderNewer