PhpToken::getTokenName

(PHP 8)

PhpToken::getTokenNameReturns the name of the token.

Description

public PhpToken::getTokenName(): ?string

Returns the name of the token.

Liste de paramètres

Cette fonction ne contient aucun paramètre.

Valeurs de retour

An ASCII character for single-char tokens, or one of T_* constant names for known tokens (see Liste des jetons de l'analyseur), or null for unknown tokens.

Exemples

Exemple #1 PhpToken::getTokenName() example

<?php
// known token
$token = new PhpToken(T_ECHO, 'echo');
var_dump($token->getTokenName()); // -> string(6) "T_ECHO"

// single-char token
$token = new PhpToken(ord(';'), ';');
var_dump($token->getTokenName()); // -> string(1) ";"

// unknown token
$token = new PhpToken(10000 , "\0");
var_dump($token->getTokenName()); // -> NULL

Voir aussi

add a note add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top