<?php
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
The name of a variable always starts with a $
The character next to $ can NEVER be numeric
The characters: _, Ç e ç are allowed
Reserved characters, of course, can not be used
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
?>
STRING GENERAL REPRESENTATION |
||
SIMBOL | NAME | USE |
$ | DOLLAR SIGN | First character of VARIÁVEL name |
$name (*) | IDENTIFIES THE VARIABLE | Defined by the user at programming time |
= | EQUAL | Value assignment character |
; | SEMICOLON | MANDATORY character of termination in code line |
(*) The character next to $ can NEVER be NUMERIC. (*) Characters like: _, ç e Ç are allowed. (*) Reserved characters, of course, can not be used. |
||
ed48 |
STRING EXTENDED SPECIFICATION |
|
STRING | TYPE |
SINGLE QUOTED | ' string '; |
DOUBLE QUOTED | " string "; |
HEREDOC SYNTAX | <<<EOT string of multiple lines EOT; |
NEWDOC SYNTAX | <<<'EOD' string of multiple lines EOD;" |
ed48 |
STRING ESCAPED CHARACTER |
|
REPRESENTATION | MEANING |
\n | Linefeed (LF or 0x0A (10) in ASCII) |
\r | Carriage return (CR or 0x0D (13) in ASCII) |
\t | Horizontal tab (HT or 0x09 (9) in ASCII) |
\v | Vertical tab (VT or 0x0B (11) in ASCII) (since PHP 5.2.5) |
\e | Escape (ESC or 0x1B (27) in ASCII) (since PHP 5.4.4) |
\f | Form feed (FF or 0x0C (12) in ASCII) (since PHP 5.2.5) |
\\ | BACKSLASH |
\$ | DOLLAR SIGN |
\' | SINGLE-QUOTE |
\" | DOUBLE-QUOTE |
\[0-7]{1,3} |
The sequence of characters matching the regular expression is a character in octal notation, which silently overflows to fit in a byte (e.g. "\400" === "\000") |
\x[0-9A-Fa-f]{1,2} |
The sequence of characters matching the regular expression is a character in hexadecimal notation. |
\u{[0-9A-Fa-f]+} |
The sequence of characters matching the regular expression is a Unicode codepoint, which will be output to the string as that codepoint's UTF-8 representation. (added in PHP 7.0.0) |
ed48 |
<?php
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SOME VALID VARIABLE EXAMPLES
STRING: USER-DEFINED
All VARIABLES after the value assignment
must end with a SEMICOLON.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
$xyz = "\"STRING DELIMITED BY DOUBLE QUOTATION MARKS\"";
$str0 = '\'STRING DELIMITED BY SINGLE QUOTATION MARKS\'';
$carÇ = '\'STRING DELIMITED BY SINGLE "QUOTATION MARKS"\'';
$_alo = "\"STRING DELIMITED BY DOUBLE 'QUOTATION MARKS'\"";
$rquo = " » ";
$str01a = "1AnVXY234";
$str01b = "1234567";
// HEREDOC
$str01c = <<<EOD
Easy come, easy go.
If you can’t beat them, join them.
Life begins at forty.
Two heads are better than one.
EOD;
$str01d = <<<EOT
In PHP there are TWO types
of variables:
INTERNAL, (predefined).
OF USER: (user-defined).
EOT;
// NOWDOC
$str01e = <<<'EOD'
Easy come, easy go.
If you can’t beat them, join them.
Life begins at forty.
Two heads are better than one.
EOD;
$str01f = <<<'EOT'
In PHP there are TWO types
of variables:
INTERNAL, (predefined).
OF USER: (user-defined).
EOT;
?>