← All docs

json_encode()

Returns the JSON representation of a value.

json_encode()

function json_encode(mixed $value, int $flags = 0, int $depth = 512): string

Returns the JSON representation of a value.

Parameters:

  • $value (mixed)
  • $flags (int), default 0, optional
  • $depth (int), default 512, optional

Returns: string

No examples yet — check examples/ and showcases/ for usage patterns.

Internals

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