Documentation

Exporter
in package

A nifty utility for visualizing PHP variables.

$exporter = new Exporter; print $exporter->export(new Exception);

Table of Contents

export()  : string
Exports a value as a string
shortenedExport()  : string
Exports a value into a single-line string
shortenedRecursiveExport()  : string
toArray()  : array<string|int, mixed>
Converts an object to an array containing all of its private, protected and public properties.
recursiveExport()  : string
Recursive implementation of export

Methods

export()

Exports a value as a string

public export(mixed $value, int $indentation) : string

The output of this method is similar to the output of print_r(), but improved in various aspects:

  • NULL is rendered as "null" (instead of "")
  • TRUE is rendered as "true" (instead of "1")
  • FALSE is rendered as "false" (instead of "")
  • Strings are always quoted with single quotes
  • Carriage returns and newlines are normalized to \n
  • Recursion and repeated rendering is treated properly
Parameters
$value : mixed
$indentation : int

The indentation level of the 2nd+ line

Return values
string

shortenedExport()

Exports a value into a single-line string

public shortenedExport(mixed $value) : string

The output of this method is similar to the output of SebastianBergmann\Exporter\Exporter::export().

Newlines are replaced by the visible string '\n'. Contents of arrays and objects (if any) are replaced by '...'.

Parameters
$value : mixed
Tags
see
Exporter::export
Return values
string

shortenedRecursiveExport()

public shortenedRecursiveExport(mixed &$data[, Context $context = null ]) : string
Parameters
$data : mixed
$context : Context = null
Return values
string

toArray()

Converts an object to an array containing all of its private, protected and public properties.

public toArray(mixed $value) : array<string|int, mixed>
Parameters
$value : mixed
Return values
array<string|int, mixed>

recursiveExport()

Recursive implementation of export

protected recursiveExport(mixed &$value, int $indentation[, Context $processed = null ]) : string
Parameters
$value : mixed

The value to export

$indentation : int

The indentation level of the 2nd+ line

$processed : Context = null

Previously processed objects

Tags
see
Exporter::export
Return values
string

Search results