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 $if = 'if'; 60 var $endswitch = 'endswitch'; 61 var $finally = 'finally'; 62 var $for = 'for'; 63 var $foreach = 'foreach'; 64 var $declare = 'declare'; 65 var $case = 'case'; 66 var $do = 'do'; 67 var $while = 'while'; 68 var $as = 'as'; 69 var $catch = 'catch'; 70 var $die = 'die'; 71 var $self = 'self'; 72 var $parent = 'parent'; 73 var $isset = 'isset'; 74 var $unset = 'unset'; 75 var $__CLASS__ = '__CLASS__'; 76 var $__TRAIT__ = '__TRAIT__'; 77 var $__FUNCTION__ = '__FUNCTION__'; 78 var $__METHOD__ = '__METHOD__'; 79 var $__LINE__ = '__LINE__'; 80 var $__FILE__ = '__FILE__'; 81 var $__DIR__ = '__DIR__'; 82 var $__NAMESPACE__ = '__NAMESPACE__'; 83 var $__halt_compiler = '__halt_compiler'; 84} 85 86$obj = new Obj; 87 88echo $obj->empty, PHP_EOL; 89echo $obj->callable, PHP_EOL; 90echo $obj->class, PHP_EOL; 91echo $obj->trait, PHP_EOL; 92echo $obj->extends, PHP_EOL; 93echo $obj->implements, PHP_EOL; 94echo $obj->static, PHP_EOL; 95echo $obj->abstract, PHP_EOL; 96echo $obj->final, PHP_EOL; 97echo $obj->public, PHP_EOL; 98echo $obj->protected, PHP_EOL; 99echo $obj->private, PHP_EOL; 100echo $obj->const, PHP_EOL; 101echo $obj->enddeclare, PHP_EOL; 102echo $obj->endfor, PHP_EOL; 103echo $obj->endforeach, PHP_EOL; 104echo $obj->endif, PHP_EOL; 105echo $obj->endwhile, PHP_EOL; 106echo $obj->and, PHP_EOL; 107echo $obj->global, PHP_EOL; 108echo $obj->goto, PHP_EOL; 109echo $obj->instanceof, PHP_EOL; 110echo $obj->insteadof, PHP_EOL; 111echo $obj->interface, PHP_EOL; 112echo $obj->namespace, PHP_EOL; 113echo $obj->new, PHP_EOL; 114echo $obj->or, PHP_EOL; 115echo $obj->xor, PHP_EOL; 116echo $obj->try, PHP_EOL; 117echo $obj->use, PHP_EOL; 118echo $obj->var, PHP_EOL; 119echo $obj->exit, PHP_EOL; 120echo $obj->list, PHP_EOL; 121echo $obj->clone, PHP_EOL; 122echo $obj->include, PHP_EOL; 123echo $obj->include_once, PHP_EOL; 124echo $obj->throw, PHP_EOL; 125echo $obj->array, PHP_EOL; 126echo $obj->print, PHP_EOL; 127echo $obj->echo, PHP_EOL; 128echo $obj->require, PHP_EOL; 129echo $obj->require_once, PHP_EOL; 130echo $obj->return, PHP_EOL; 131echo $obj->else, PHP_EOL; 132echo $obj->elseif, PHP_EOL; 133echo $obj->default, PHP_EOL; 134echo $obj->break, PHP_EOL; 135echo $obj->continue, PHP_EOL; 136echo $obj->switch, PHP_EOL; 137echo $obj->yield, PHP_EOL; 138echo $obj->function, PHP_EOL; 139echo $obj->if, PHP_EOL; 140echo $obj->endswitch, PHP_EOL; 141echo $obj->finally, PHP_EOL; 142echo $obj->for, PHP_EOL; 143echo $obj->foreach, PHP_EOL; 144echo $obj->declare, PHP_EOL; 145echo $obj->case, PHP_EOL; 146echo $obj->do, PHP_EOL; 147echo $obj->while, PHP_EOL; 148echo $obj->as, PHP_EOL; 149echo $obj->catch, PHP_EOL; 150echo $obj->die, PHP_EOL; 151echo $obj->self, PHP_EOL; 152echo $obj->parent, PHP_EOL; 153echo $obj->isset, PHP_EOL; 154echo $obj->unset, PHP_EOL; 155echo $obj->__CLASS__, PHP_EOL; 156echo $obj->__TRAIT__, PHP_EOL; 157echo $obj->__FUNCTION__, PHP_EOL; 158echo $obj->__METHOD__, PHP_EOL; 159echo $obj->__LINE__, PHP_EOL; 160echo $obj->__FILE__, PHP_EOL; 161echo $obj->__DIR__, PHP_EOL; 162echo $obj->__NAMESPACE__, PHP_EOL; 163echo $obj->__halt_compiler, PHP_EOL; 164 165echo "\nDone\n"; 166 167?> 168--EXPECTF-- 169empty 170callable 171class 172trait 173extends 174implements 175static 176abstract 177final 178public 179protected 180private 181const 182enddeclare 183endfor 184endforeach 185endif 186endwhile 187and 188global 189goto 190instanceof 191insteadof 192interface 193namespace 194new 195or 196xor 197try 198use 199var 200exit 201list 202clone 203include 204include_once 205throw 206array 207print 208echo 209require 210require_once 211return 212else 213elseif 214default 215break 216continue 217switch 218yield 219function 220if 221endswitch 222finally 223for 224foreach 225declare 226case 227do 228while 229as 230catch 231die 232self 233parent 234isset 235unset 236__CLASS__ 237__TRAIT__ 238__FUNCTION__ 239__METHOD__ 240__LINE__ 241__FILE__ 242__DIR__ 243__NAMESPACE__ 244__halt_compiler 245 246Done 247