← All docs

token_get_all()

Split PHP source into tokens while preserving its original bytes.

token_get_all()

function token_get_all(string $code, int $flags = 0): array

Split PHP source into tokens while preserving its original bytes.

Parameters:

  • $code (string)
  • $flags (int), default 0, optional

Returns: array

Availability

Compiled (AOT)Magician (eval)
AvailableAvailable

No examples yet. Check examples/ and showcases/ for usage patterns.

Internals

For how token_get_all is implemented in the compiler, see the internals page.