Php format output file var_export function instance ,. An example of the var_export function output file in php format. this example describes the usage of the var_export function in the output file in php format. Share it with you for your reference. The details are as follows: var_export function instance of the php output file,
This article describes how to use the var_export function in the php output file. Share it with you for your reference. The details are as follows:
Var_export: php 4> = 4.2.0, php 5
Var_export -- output or returns a string representation of a variable.
Description: mixed var_export (mixed expression [, bool return])
This function returns the structure information about the variables passed to this function. it is similar to var_dump (). The difference is that the returned representation is legal php code, you can set the second parameter of the function to true to return the expression of the variable.
Example:
The code is as follows:
Var_export (array ('A', 'B', array ('A', 'BB ', 'CC') // This is no different from var_dump.
[Code] $ var = var_export (array ('A', 'B', array ('A', 'BB ', 'CC'), true) // after true is added, a variable is provided instead of being printed, so that the output can be directly made;
Echo $ var; // the output format is similar to that of var_dump.
Example 2:
The code is as follows:
$ Data = array ('name' => 'ABC', 'job' => 'grammer ', 'a' => array ('A', 'CC ', 'BB '));
$ Data = var_export ($ data, true );
Echo $ data;
The output format is as follows:
The code is as follows:
Array (
'Name' => 'ABC ',
'Job' => 'grammer ',
'A' =>
Array (
0 => 'A ',
1 => 'CC ',
2 => 'BB ',
),
)
I hope this article will help you with PHP programming.
Example: describes how to use the var_export function in the output file of php format. Share it with you for your reference. Details: var_export: php...