Knowledge baseExam Center
ENEnglish
Choose language13

CKTIS / PHP

var_export()

Render a value as PHP source syntax.

Version: PHP 8.4; repository runtime, production runtime not attested

Syntax

var_export(mixed $value, bool $return = false): ?string

Render a value as PHP source syntax. Passing true returns a string, while the default prints it and returns null. Most user-defined objects require a suitable static __set_state() to reconstruct them from the generated expression. Recursive references cannot be represented.

Signature

var_export(mixed $value, bool $return = false): ?string

Example output

'007'
false

Examples

<?php
echo var_export("007", true), "\n", var_export(false, true);

Result

'007'
false

Sources