PHP format output file Var_export function instance,
This example describes the use of the PHP format output file Var_export function. Share to everyone for your reference. Specific as follows:
var_export:php 4 >= 4.2.0, PHP 5
Var_export--outputs or returns a string representation of a variable.
Description: Mixed var_export (mixed expression [, bool return])
This function returns the structure information about the variable passed to the function, which is similar to Var_dump (), but differs from its return representation as a valid PHP code, and you can return the representation of the variable by setting the second argument of the function to true.
Example: copy code code as follows: Var_export (Array (' A ', ' B ', array (' AA ', ' BB ', ' cc '))//This is no different from var_dump
[Code] $var =var_export (Array (' A ', ' B ', array (' AA ', ' BB ', ' cc '), true)//plus true, will not print out, but give a variable, so you can directly output;
echo $var;//The output form is similar to Var_dump () printing.
Example 2, the code is as follows:
Copy the code as follows: $data = Array (' name ' = = ' abc ', ' job ' = ' programmer ', ' a ' =>array (' AA ', ' cc ', ' BB ');
$data = Var_export ($data, true);
Echo $data;
The output form is as follows:
Copy the Code code as follows: Array (
' Name ' = ' abc ',
' Job ' = ' programmer ',
' A ' + =
Array (
0 = ' AA ',
1 = ' CC ',
2 = ' BB ',
),
)
I hope this article is helpful to everyone's PHP programming.
http://www.bkjia.com/PHPjc/912281.html www.bkjia.com true http://www.bkjia.com/PHPjc/912281.html techarticle PHP Format output file Var_export function instance, the example of this article describes the PHP format output file Var_export function usage. Share to everyone for your reference. Specific as follows: var_export:php ...