1--TEST-- 2Test semi-reserved words as class constants 3--FILE-- 4<?php 5 6class Obj 7{ 8 const EMPTY = 'empty'; 9 const CALLABLE = 'callable'; 10 const TRAIT = 'trait'; 11 const EXTENDS = 'extends'; 12 const IMPLEMENTS = 'implements'; 13 const STATIC = 'static'; 14 const ABSTRACT = 'abstract'; 15 const FINAL = 'final'; 16 const PUBLIC = 'public'; 17 const PROTECTED = 'protected'; 18 const PRIVATE = 'private'; 19 const CONST = 'const'; 20 const ENDDECLARE = 'enddeclare'; 21 const ENDFOR = 'endfor'; 22 const ENDFOREACH = 'endforeach'; 23 const ENDIF = 'endif'; 24 const ENDWHILE = 'endwhile'; 25 const AND = 'and'; 26 const GLOBAL = 'global'; 27 const GOTO = 'goto'; 28 const INSTANCEOF = 'instanceof'; 29 const INSTEADOF = 'insteadof'; 30 const INTERFACE = 'interface'; 31 const NAMESPACE = 'namespace'; 32 const NEW = 'new'; 33 const OR = 'or'; 34 const XOR = 'xor'; 35 const TRY = 'try'; 36 const USE = 'use'; 37 const VAR = 'var'; 38 const EXIT = 'exit'; 39 const LIST = 'list'; 40 const CLONE = 'clone'; 41 const INCLUDE = 'include'; 42 const INCLUDE_ONCE = 'include_once'; 43 const THROW = 'throw'; 44 const ARRAY = 'array'; 45 const PRINT = 'print'; 46 const ECHO = 'echo'; 47 const REQUIRE = 'require'; 48 const REQUIRE_ONCE = 'require_once'; 49 const RETURN = 'return'; 50 const ELSE = 'else'; 51 const ELSEIF = 'elseif'; 52 const DEFAULT = 'default'; 53 const BREAK = 'break'; 54 const CONTINUE = 'continue'; 55 const SWITCH = 'switch'; 56 const YIELD = 'yield'; 57 const FUNCTION = 'function'; 58 const IF = 'if'; 59 const ENDSWITCH = 'endswitch'; 60 const FINALLY = 'finally'; 61 const FOR = 'for'; 62 const FOREACH = 'foreach'; 63 const DECLARE = 'declare'; 64 const CASE = 'case'; 65 const DO = 'do'; 66 const WHILE = 'while'; 67 const AS = 'as'; 68 const CATCH = 'catch'; 69 const DIE = 'die'; 70 const SELF = 'self'; 71 const PARENT = 'parent'; 72 const ISSET = 'isset'; 73 const UNSET = 'unset'; 74 const __CLASS__ = '__CLASS__'; 75 const __TRAIT__ = '__TRAIT__'; 76 const __FUNCTION__ = '__FUNCTION__'; 77 const __METHOD__ = '__METHOD__'; 78 const __LINE__ = '__LINE__'; 79 const __FILE__ = '__FILE__'; 80 const __DIR__ = '__DIR__'; 81 const __NAMESPACE__ = '__NAMESPACE__'; 82} 83 84echo Obj::EMPTY, PHP_EOL; 85echo Obj::CALLABLE, PHP_EOL; 86echo Obj::TRAIT, PHP_EOL; 87echo Obj::EXTENDS, PHP_EOL; 88echo Obj::IMPLEMENTS, PHP_EOL; 89echo Obj::STATIC, PHP_EOL; 90echo Obj::ABSTRACT, PHP_EOL; 91echo Obj::FINAL, PHP_EOL; 92echo Obj::PUBLIC, PHP_EOL; 93echo Obj::PROTECTED, PHP_EOL; 94echo Obj::PRIVATE, PHP_EOL; 95echo Obj::CONST, PHP_EOL; 96echo Obj::ENDDECLARE, PHP_EOL; 97echo Obj::ENDFOR, PHP_EOL; 98echo Obj::ENDFOREACH, PHP_EOL; 99echo Obj::ENDIF, PHP_EOL; 100echo Obj::ENDWHILE, PHP_EOL; 101echo Obj::AND, PHP_EOL; 102echo Obj::GLOBAL, PHP_EOL; 103echo Obj::GOTO, PHP_EOL; 104echo Obj::INSTANCEOF, PHP_EOL; 105echo Obj::INSTEADOF, PHP_EOL; 106echo Obj::INTERFACE, PHP_EOL; 107echo Obj::NAMESPACE, PHP_EOL; 108echo Obj::NEW, PHP_EOL; 109echo Obj::OR, PHP_EOL; 110echo Obj::XOR, PHP_EOL; 111echo Obj::TRY, PHP_EOL; 112echo Obj::USE, PHP_EOL; 113echo Obj::VAR, PHP_EOL; 114echo Obj::EXIT, PHP_EOL; 115echo Obj::LIST, PHP_EOL; 116echo Obj::CLONE, PHP_EOL; 117echo Obj::INCLUDE, PHP_EOL; 118echo Obj::INCLUDE_ONCE, PHP_EOL; 119echo Obj::THROW, PHP_EOL; 120echo Obj::ARRAY, PHP_EOL; 121echo Obj::PRINT, PHP_EOL; 122echo Obj::ECHO, PHP_EOL; 123echo Obj::REQUIRE, PHP_EOL; 124echo Obj::REQUIRE_ONCE, PHP_EOL; 125echo Obj::RETURN, PHP_EOL; 126echo Obj::ELSE, PHP_EOL; 127echo Obj::ELSEIF, PHP_EOL; 128echo Obj::DEFAULT, PHP_EOL; 129echo Obj::BREAK, PHP_EOL; 130echo Obj::CONTINUE, PHP_EOL; 131echo Obj::SWITCH, PHP_EOL; 132echo Obj::YIELD, PHP_EOL; 133echo Obj::FUNCTION, PHP_EOL; 134echo Obj::IF, PHP_EOL; 135echo Obj::ENDSWITCH, PHP_EOL; 136echo Obj::FINALLY, PHP_EOL; 137echo Obj::FOR, PHP_EOL; 138echo Obj::FOREACH, PHP_EOL; 139echo Obj::DECLARE, PHP_EOL; 140echo Obj::CASE, PHP_EOL; 141echo Obj::DO, PHP_EOL; 142echo Obj::WHILE, PHP_EOL; 143echo Obj::AS, PHP_EOL; 144echo Obj::CATCH, PHP_EOL; 145echo Obj::DIE, PHP_EOL; 146echo Obj::SELF, PHP_EOL; 147echo Obj::PARENT, PHP_EOL; 148echo Obj::ISSET, PHP_EOL; 149echo Obj::UNSET, PHP_EOL; 150echo Obj::__CLASS__, PHP_EOL; 151echo Obj::__TRAIT__, PHP_EOL; 152echo Obj::__FUNCTION__, PHP_EOL; 153echo Obj::__METHOD__, PHP_EOL; 154echo Obj::__LINE__, PHP_EOL; 155echo Obj::__FILE__, PHP_EOL; 156echo Obj::__DIR__, PHP_EOL; 157echo Obj::__NAMESPACE__, PHP_EOL; 158 159echo "\nDone\n"; 160--EXPECT-- 161empty 162callable 163trait 164extends 165implements 166static 167abstract 168final 169public 170protected 171private 172const 173enddeclare 174endfor 175endforeach 176endif 177endwhile 178and 179global 180goto 181instanceof 182insteadof 183interface 184namespace 185new 186or 187xor 188try 189use 190var 191exit 192list 193clone 194include 195include_once 196throw 197array 198print 199echo 200require 201require_once 202return 203else 204elseif 205default 206break 207continue 208switch 209yield 210function 211if 212endswitch 213finally 214for 215foreach 216declare 217case 218do 219while 220as 221catch 222die 223self 224parent 225isset 226unset 227__CLASS__ 228__TRAIT__ 229__FUNCTION__ 230__METHOD__ 231__LINE__ 232__FILE__ 233__DIR__ 234__NAMESPACE__ 235 236Done 237