Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Alternatives to var_export

Tags:

php

var_export function causes an exception while argument has circular references. Are there any alternatives (except serialize) which handle it correctly?

like image 267
darja Avatar asked Apr 21 '10 12:04

darja


2 Answers

You could try this :

ob_start();
var_dump($var);
$dump = ob_get_contents();
ob_end_clean();

And why can't you use serialize ?

like image 128
DuoSRX Avatar answered Sep 23 '22 01:09

DuoSRX


Are you looking for var_dump or even debug_backtrace

Update:

Converting object to string

like image 31
Sarfraz Avatar answered Sep 23 '22 01:09

Sarfraz