← All docs

getenv()

Gets the value of an environment variable, or the whole environment.

getenv()

function getenv(?string $name = null, bool $local_only = false): string|array|false

Gets the value of an environment variable, or the whole environment.

Parameters:

  • $name (?string), default null, optional
  • $local_only (bool), default false, optional

Returns: string|array|false

Availability

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

Internals

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