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