Documentation

VarExporter
in package

FinalYes

Exports serializable PHP values to PHP code.

VarExporter allows serializing PHP data structures to plain PHP code (like var_export()) while preserving all the semantics associated with serialize() (unlike var_export()).

By leveraging OPcache, the generated PHP code is faster than doing the same with unserialize().

Tags
author

Nicolas Grekas p@tchwork.com

Table of Contents

Methods

export()  : string
Exports a serializable PHP value to PHP code.

Methods

export()

Exports a serializable PHP value to PHP code.

public static export(mixed $value[, bool &$isStaticValue = null ][, array<class-string, class-string> &$foundClasses = [] ]) : string
Parameters
$value : mixed
$isStaticValue : bool = null

Set to true after execution if the provided value is static, false otherwise

$foundClasses : array<class-string, class-string> = []

Classes found in the value are added to this list as both keys and values

Tags
throws
ExceptionInterface

When the provided value cannot be serialized

Return values
string

        
On this page

Search results