var_representation

PECL var_representation >= 0.1.0
var_representation - Returns a short, readable, parsable string representation of a variable
Manual
Code Examples

Example #1 var_representation Examples

Result: [ 1, 2, [ 'key' => 'value', ], ] [1, 2, ['key' => 'value']]
PHP Version:

Example #2 Escaping control characters

Result: "Content-Length: 123\r\n"
PHP Version:

Example #3 Exporting stdClass

Result: (object) [ 'name' => 'ElePHPant ElePHPantsdotter', 'website' => 'https://php.net/elephpant.php', ]
PHP Version:

Example #4 Exporting classes

Result: \A::__set_state([ 'var' => 5, ])
PHP Version:

Example #5 Using __set_state()

Result: object(A)#2 (2) { ["var1"]=> int(5) ["var2"]=> string(3) "foo" }
PHP Version:


Function var_representation:

var_representation Functions

Most used PHP functions