Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b5f8966

Browse files
committed
Add php notes
1 parent 9f6684a commit b5f8966

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

topic/language/php_syntax.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
PHP Syntax Note
2+
======
3+
4+
## General
5+
6+
- A PHP script starts with `<?php` and ends with `?>`. You can also use the shorthand PHP tags, `<?` and `?>`, as long as they're supported by the server.
7+
- PHP statements end with semicolons `;`.
8+
- Comment: single-line `//`, multi-line begins with `/*` and ends with `*/`.
9+
10+
## Variable and Constant
11+
12+
`$variable_name = value;`
13+
`echo $variable_name;`
14+
15+
- A variable name can only contain alpha-numeric characters and underscores. (`A-z`, `0-9`, and `_`)
16+
- A variable name must start with a letter or an underscore.
17+
- Variable names are case-sensitive. (`$name` and `$NAME` would be two different variables)
18+
19+
`define(CONSTANT_NAME, value, case-insensitive);`
20+
`echo CONSTANT_NAME;`
21+
22+
- Constants are similar to variables except that they cannot be changed or undefined after they've been defined.
23+
- name: Specifies the name of the constant.
24+
- value: Specifies the value of the constant.
25+
- case-insensitive: Specifies whether the constant name should be case-insensitive. Default is `false`.

0 commit comments

Comments
 (0)