123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156 |
- Literals
- -----
- <?php
- // magic constants
- __LINE__;
- __FILE__;
- __DIR__;
- __FUNCTION__;
- __CLASS__;
- __TRAIT__;
- __METHOD__;
- __NAMESPACE__;
- // not actually literals, but close
- null;
- true;
- false;
- NULL;
- TRUE;
- FALSE;
- // integers (normalized to decimal)
- 0;
- 11;
- 011;
- 0x11;
- 0b11;
- // floats (normalized to ... something)
- 0.;
- .0;
- 0.0;
- 0e1000;
- 1.0;
- 1e100;
- 1e1000;
- 1E-100;
- 1000000000000000000000000000000000000000000000000000000000000000000000000000000000000;
- 378282246310005.0;
- 10000000000000002.0;
- // strings (normalized to single quoted)
- 'a';
- 'a
- b';
- "a";
- "a\nb";
- 'a\'b';
- "a'b";
- "a\b";
- <<<'STR'
- a\nb$a
- {$b}
- STR;
- // strings (normalized to double quoted)
- "$a";
- "a$b";
- "$a$b";
- "$a $b";
- "a${b}c";
- "a{$b}c";
- "a$a[b]c";
- "\{$A}";
- "\{ $A }";
- "\\{$A}";
- "\\{ $A }";
- "{$$A}[B]";
- "$$A[B]";
- <<<STR
- a\nb$a\n{$b}
- STR;
- // make sure indentation doesn't mess anything up
- function foo()
- {
- "a\nb";
- 'a
- b';
- 'a
- b';
- }
- -----
- // magic constants
- __LINE__;
- __FILE__;
- __DIR__;
- __FUNCTION__;
- __CLASS__;
- __TRAIT__;
- __METHOD__;
- __NAMESPACE__;
- // not actually literals, but close
- null;
- true;
- false;
- NULL;
- TRUE;
- FALSE;
- // integers (normalized to decimal)
- 0;
- 11;
- 9;
- 17;
- 3;
- // floats (normalized to ... something)
- 0.0;
- 0.0;
- 0.0;
- 0.0;
- 1.0;
- 1.0E+100;
- INF;
- 1.0E-100;
- 1.0E+84;
- 378282246310005.0;
- 10000000000000002.0;
- // strings (normalized to single quoted)
- 'a';
- 'a
- b';
- 'a';
- 'a
- b';
- 'a\'b';
- 'a\'b';
- 'a\\b';
- 'a\\nb$a
- {$b}';
- // strings (normalized to double quoted)
- "{$a}";
- "a{$b}";
- "{$a}{$b}";
- "{$a} {$b}";
- "a{$b}c";
- "a{$b}c";
- "a{$a['b']}c";
- "\\{{$A}}";
- "\\{ {$A} }";
- "\\{$A}";
- "\\{ {$A} }";
- "{${$A}}[B]";
- "\${$A['B']}";
- "a\nb{$a}\n{$b}";
- // make sure indentation doesn't mess anything up
- function foo()
- {
- 'a
- b';
- 'a
- b';
- 'a
- b';
- }
|