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 161--EXPECTF-- 162empty 163callable 164trait 165extends 166implements 167static 168abstract 169final 170public 171protected 172private 173const 174enddeclare 175endfor 176endforeach 177endif 178endwhile 179and 180global 181goto 182instanceof 183insteadof 184interface 185namespace 186new 187or 188xor 189try 190use 191var 192exit 193list 194clone 195include 196include_once 197throw 198array 199print 200echo 201require 202require_once 203return 204else 205elseif 206default 207break 208continue 209switch 210yield 211function 212if 213endswitch 214finally 215for 216foreach 217declare 218case 219do 220while 221as 222catch 223die 224self 225parent 226isset 227unset 228__CLASS__ 229__TRAIT__ 230__FUNCTION__ 231__METHOD__ 232__LINE__ 233__FILE__ 234__DIR__ 235__NAMESPACE__ 236 237Done 238