Skip to content

Instantly share code, notes, and snippets.

@hacfi
Created May 9, 2015 06:09
Show Gist options
  • Save hacfi/b634580de56772e9a7d9 to your computer and use it in GitHub Desktop.
Save hacfi/b634580de56772e9a7d9 to your computer and use it in GitHub Desktop.
PHP Token Constants List
<?php
$tokenConstants = array_filter(
get_defined_constants(),
function ($value, $key) {
return substr($key, 0, 2) === 'T_';
},
ARRAY_FILTER_USE_BOTH
);
echo 'Token | Value' . PHP_EOL;
echo '------------------------------ | -----' . PHP_EOL;
foreach ($tokenConstants as $tokenConstant => $value) {
printf("%-30s | %s\n", $tokenConstant, $value);
}
Token Value
T_FMT 3
T_FMT_AMPM 4
T_REQUIRE_ONCE 258
T_REQUIRE 259
T_EVAL 260
T_INCLUDE_ONCE 261
T_INCLUDE 262
T_LOGICAL_OR 263
T_LOGICAL_XOR 264
T_LOGICAL_AND 265
T_PRINT 266
T_YIELD 267
T_POW_EQUAL 268
T_SR_EQUAL 269
T_SL_EQUAL 270
T_XOR_EQUAL 271
T_OR_EQUAL 272
T_AND_EQUAL 273
T_MOD_EQUAL 274
T_CONCAT_EQUAL 275
T_DIV_EQUAL 276
T_MUL_EQUAL 277
T_MINUS_EQUAL 278
T_PLUS_EQUAL 279
T_BOOLEAN_OR 280
T_BOOLEAN_AND 281
T_IS_NOT_IDENTICAL 282
T_IS_IDENTICAL 283
T_IS_NOT_EQUAL 284
T_IS_EQUAL 285
T_IS_GREATER_OR_EQUAL 286
T_IS_SMALLER_OR_EQUAL 287
T_SR 288
T_SL 289
T_INSTANCEOF 290
T_UNSET_CAST 291
T_BOOL_CAST 292
T_OBJECT_CAST 293
T_ARRAY_CAST 294
T_STRING_CAST 295
T_DOUBLE_CAST 296
T_INT_CAST 297
T_DEC 298
T_INC 299
T_POW 300
T_CLONE 301
T_NEW 302
T_EXIT 303
T_IF 304
T_ELSEIF 305
T_ELSE 306
T_ENDIF 307
T_LNUMBER 308
T_DNUMBER 309
T_STRING 310
T_STRING_VARNAME 311
T_VARIABLE 312
T_NUM_STRING 313
T_INLINE_HTML 314
T_CHARACTER 315
T_BAD_CHARACTER 316
T_ENCAPSED_AND_WHITESPACE 317
T_CONSTANT_ENCAPSED_STRING 318
T_ECHO 319
T_DO 320
T_WHILE 321
T_ENDWHILE 322
T_FOR 323
T_ENDFOR 324
T_FOREACH 325
T_ENDFOREACH 326
T_DECLARE 327
T_ENDDECLARE 328
T_AS 329
T_SWITCH 330
T_ENDSWITCH 331
T_CASE 332
T_DEFAULT 333
T_BREAK 334
T_CONTINUE 335
T_GOTO 336
T_FUNCTION 337
T_CONST 338
T_RETURN 339
T_TRY 340
T_CATCH 341
T_FINALLY 342
T_THROW 343
T_USE 344
T_INSTEADOF 345
T_GLOBAL 346
T_PUBLIC 347
T_PROTECTED 348
T_PRIVATE 349
T_FINAL 350
T_ABSTRACT 351
T_STATIC 352
T_VAR 353
T_UNSET 354
T_ISSET 355
T_EMPTY 356
T_HALT_COMPILER 357
T_CLASS 358
T_TRAIT 359
T_INTERFACE 360
T_EXTENDS 361
T_IMPLEMENTS 362
T_OBJECT_OPERATOR 363
T_DOUBLE_ARROW 364
T_LIST 365
T_ARRAY 366
T_CALLABLE 367
T_CLASS_C 368
T_TRAIT_C 369
T_METHOD_C 370
T_FUNC_C 371
T_LINE 372
T_FILE 373
T_COMMENT 374
T_DOC_COMMENT 375
T_OPEN_TAG 376
T_OPEN_TAG_WITH_ECHO 377
T_CLOSE_TAG 378
T_WHITESPACE 379
T_START_HEREDOC 380
T_END_HEREDOC 381
T_DOLLAR_OPEN_CURLY_BRACES 382
T_CURLY_OPEN 383
T_PAAMAYIM_NEKUDOTAYIM 384
T_NAMESPACE 385
T_NS_C 386
T_DIR 387
T_NS_SEPARATOR 388
T_ELLIPSIS 389
T_DOUBLE_COLON 384
@hacfi
Copy link
Author

hacfi commented Jul 17, 2019

Thanks for the info @BenMorel!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment