note 70293 added to function.var-export
| From: | dosperiosatdotgmaildotnospamdocom at osu1 dot php dot net | Date: | Tue, 10 Oct 2006 18:19:51 +0000 |
| Subject: | note 70293 added to function.var-export | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-118354@lists.php.net to get a copy of this message | ||
Here is a nifty function to export an object with var_export without the keys, which can be useful
if you want to export an array but don't want the keys (for example if you want to be able to
easily add something in the middle of the array by hand).
<?
function var_export_nokeys ($obj, $ret=false) {
$retval = preg_replace("/'?\w+'?\s+=>\s+/", '', var_export($obj,
true));
if ($ret===true) {
return $retval;
} else {
print $retval;
}
}
?>
Works the same as var_export obviously. I found it useful, maybe someone else will too!
----
Server IP: 194.109.193.119
Probable Submitter: 84.35.17.36
----
Manual Page -- http://www.php.net/manual/en/function.var-export.php
Edit -- https://master.php.net/note/edit/70293
Del: integrated -- https://master.php.net/note/delete/70293/integrated
Del: useless -- https://master.php.net/note/delete/70293/useless
Del: bad code -- https://master.php.net/note/delete/70293/bad+code
Del: spam -- https://master.php.net/note/delete/70293/spam
Del: non-english -- https://master.php.net/note/delete/70293/non-english
Del: in docs -- https://master.php.net/note/delete/70293/in+docs
Del: other reasons-- https://master.php.net/note/delete/70293
Reject -- https://master.php.net/note/reject/70293
Search -- https://master.php.net/manage/user-notes.php