45 lines
1.1 KiB
Markdown
45 lines
1.1 KiB
Markdown
---
|
|
title: Basic Syntax
|
|
localeTitle: Sintaxis basica
|
|
---
|
|
# Sintaxis basica
|
|
|
|
Un script PHP se puede colocar en cualquier parte del documento.
|
|
|
|
Un script PHP comienza con `<?php` y termina con `?>`
|
|
|
|
A continuación, tenemos un ejemplo de un archivo PHP simple, con un script PHP que utiliza una función de PHP "echo" para generar el texto "Hello World!" en una página web
|
|
|
|
\`\` \`\`
|
|
|
|
# Mi primera página PHP
|
|
```
|
|
The output of that would be :
|
|
```
|
|
|
|
Mi primera página PHP
|
|
|
|
Hola 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):
|
|
```
|
|
|
|
\`\` \`\` |