semi_reserved_004.phpt 5.2 KB

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