45 lines
1.1 KiB
Markdown
45 lines
1.1 KiB
Markdown
---
|
|
title: Basic Syntax
|
|
localeTitle: Sintaxe Básica
|
|
---
|
|
# Sintaxe Básica
|
|
|
|
Um script PHP pode ser colocado em qualquer parte do documento.
|
|
|
|
Um script PHP começa com `<?php` e termina com `?>`
|
|
|
|
Abaixo, temos um exemplo de um arquivo PHP simples, com um script PHP que usa uma função PHP integrada "echo" para gerar o texto "Hello World!" numa página web
|
|
|
|
\`\` \`\`
|
|
|
|
# Minha primeira página PHP
|
|
```
|
|
The output of that would be :
|
|
```
|
|
|
|
Minha primeira página PHP
|
|
|
|
Olá Mundo!
|
|
```
|
|
#### Note: PHP statements end with a semicolon (;).
|
|
|
|
# Comments in PHP
|
|
|
|
PHP supports several ways of commenting:
|
|
```
|
|
|
|
```
|
|
# PHP Case Sensitivity
|
|
|
|
In PHP, all keywords (eg if, else, while, echo, etc.), classes, functions, and user-defined functions are NOT case-sensitive.
|
|
|
|
In the example below, all three echo statements below are legal (and equal):
|
|
```
|
|
|
|
```
|
|
### However; all variable names are case-sensitive.
|
|
|
|
In the example below, only the first statement will display the value of the $color variable (this is because $color, $COLOR, and $coLOR are treated as three different variables):
|
|
```
|
|
|
|
\`\` \`\` |