45 lines
1.3 KiB
Markdown
45 lines
1.3 KiB
Markdown
|
---
|
|||
|
title: Basic Syntax
|
|||
|
localeTitle: Основной синтаксис
|
|||
|
---
|
|||
|
# Основной синтаксис
|
|||
|
|
|||
|
Сценарий PHP можно разместить где угодно в документе.
|
|||
|
|
|||
|
Сценарий PHP начинается с `<?php` и заканчивается на `?>`
|
|||
|
|
|||
|
Ниже приведен пример простого PHP-файла с PHP-скриптом, который использует встроенную функцию PHP «echo» для вывода текста «Hello World!». на веб-странице
|
|||
|
|
|||
|
\`\` \`\` \`
|
|||
|
|
|||
|
# Моя первая страница PHP
|
|||
|
```
|
|||
|
The output of that would be :
|
|||
|
```
|
|||
|
|
|||
|
Моя первая страница PHP
|
|||
|
|
|||
|
Привет, мир!
|
|||
|
```
|
|||
|
#### 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):
|
|||
|
```
|
|||
|
|
|||
|
\`\` \`\` \`
|