Symfony VarExporter Component

Introduction

Introduced in [Symfony 4.2](Symfony 4.2), the VarExporter Component is a better alternative to PHP’s var_export() function. The var_export() function outputs or returns a parsable string representation of a variable. It is similar to var_dump() with one exception: the returned representation is valid PHP code. Symfony’s export() function is similar, but adds lots of useful features to it.

Syntax

Array

result = VarExporter::export($data);

generates