Source code for file /phpxmlrpc/compat/var_export.php
Documentation is available at var_export.php
// +----------------------------------------------------------------------+
// +----------------------------------------------------------------------+
// | Copyright (c) 1997-2004 The PHP Group |
// +----------------------------------------------------------------------+
// | This source file is subject to version 3.0 of the PHP license, |
// | that is bundled with this package in the file LICENSE, and is |
// | available at through the world-wide-web at |
// | http://www.php.net/license/3_0.txt. |
// | If you did not receive a copy of the PHP license and are unable to |
// | obtain it through the world-wide-web, please send a note to |
// +----------------------------------------------------------------------+
// +----------------------------------------------------------------------+
// $Id: var_export.php,v 1.2 2005/11/21 10:57:23 ggiunta Exp $
* @link http://php.net/function.var_export
* @version $Revision: 1.2 $
* @require PHP 4.0.0 (user_error)
function var_export($array, $return =
false, $lvl=
0)
// Common output variables
// Check the export isn't a simple string / int
$out =
$array ?
'true' :
'false';
// Begin the array export
// Loop through each value in array
foreach ($array as $key =>
$value) {
// If the key is a string, delimit it
$key =
$stringdelim .
$key .
$stringdelim;
/*if (is_array($value)) {
// We have an array, so do some recursion
// Do some basic recursion while increasing the indent
$recur_array = explode($newline, var_export($value, true));
foreach ($recur_array as $recur_line) {
$temp_array[] = $indent . $recur_line;
$recur_array = implode($newline, $temp_array);
$value = $newline . $recur_array;
} elseif (is_null($value)) {
$value = str_replace($find, $replace, $value);
$value = $stringdelim . $value . $stringdelim;
// Piece together the line
for ($i =
0; $i <
$lvl; $i++
)
$out .=
$key .
$doublearrow .
$val .
$lineend;
for ($i =
0; $i <
$lvl; $i++
)
// Decide method of output