protected function _array2string($array)
    {
        $strings = array();

        foreach ($array as $key => $value) {
            if (is_int($key)) {
                $key = '';
            } elseif (ctype_digit((string) $key) || '.0' === substr($key, -2)) {
                $key = intval($key) . '=>' ;
            } else {
                $key = "'" . str_replace("'", "\'", $key) . "'=>" ;
            }

            if (is_array($value)) {
                $value = "'" . addcslashes(serialize($value), "'") . "'";
            } elseif (ctype_digit((string) $value)) {
                $value = intval($value);
            } else {
                $value = "'" . str_replace("'", "\'", $value) . "'";
            }

            $strings[] = $key . $value;
        }
        
        return "array(\n" . implode(",\n", $strings) . "\n)";
    }
protected function _array2string($array)
    {
        $strings = array();

        foreach ($array as $key => $value) {
            if (is_int($key)) {
                $key = '';
            } elseif (ctype_digit((string) $key) || '.0' === substr($key, -2)) {
                $key = intval($key) . '=>' ;
            } else {
                $key = "'" . str_replace("'", "\'", $key) . "'=>" ;
            }

            if (is_array($value)) {
                $value = "'" . addcslashes(serialize($value), "'") . "'";
            } elseif (ctype_digit((string) $value)) {
                $value = intval($value);
            } else {
                $value = "'" . str_replace("'", "\'", $value) . "'";
            }

            $strings[] = $key . $value;
        }
        
        return "array(\n" . implode(",\n", $strings) . "\n)";
    }
protected function _array2string ( $ array ) { $ strings = array ( ) ; foreach ( $ array as $ key => $ value ) { if ( is_int ( $ key ) ) { $ key = '' ; } elseif ( ctype_digit ( ( string ) $ key ) || '.0' === substr ( $ key , - 2 ) ) { $ key = intval ( $ key ) . '=>' ; } else { $ key = "'" . str_replace ( "'" , "\'" , $ key ) . "'=>" ; } if ( is_array ( $ value ) ) { $ value = "'" . addcslashes ( serialize ( $ value ) , "'" ) . "'" ; } elseif ( ctype_digit ( ( string ) $ value ) ) { $ value = intval ( $ value ) ; } else { $ value = "'" . str_replace ( "'" , "\'" , $ value ) . "'" ; } $ strings [ ] = $ key . $ value ; } return "array(\n" . implode ( ",\n" , $ strings ) . "\n)" ; }
Converts the given array to the PHP string which represent it.
This method optimizes the PHP code and the output differs form the
var_export one as the internal PHP function does not strip whitespace or
convert strings to numbers.

@param array $array the array to parse and convert
@return string the array parsed into a PHP string
Converts the given array to the PHP string which represent it . This method optimizes the PHP code and the output differs form the var_export one as the internal PHP function does not strip whitespace or convert strings to numbers .