Home > Backend Development > PHP Tutorial > The difference between php var_export and var_dump output_PHP tutorial

The difference between php var_export and var_dump output_PHP tutorial

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-07-21 14:59:50
Original
887 people have browsed it

Problem Found
When tracking yratings_get_targets,
error_log(var_export(yblog_mspconfiginit("ratings"),true)); always prints out yblog_mspconfiginit( "ratings") returns NULL

As a result, I thought that the connection to the DB could not be established, and I went on the wrong path for a day.
Finally I discovered that this is one of the differences between var_export and var_dump

This is:
Cause of the problem
var_export must return legal php code, that is to say, the code returned by var_export can be directly assigned as php code a variable. And this variable will get the same type of value as var_export

However, when the variable type is resource, it cannot be copied simply. Therefore, when the variable of var_export is of resource type, var_export will return NULL

Example
$res = yblog_mspconfiginit("ratings");
var_dump($res);
var_export($res); Result:

resource(1) of type (yahoo_yblog)
NULL Another example:

$res = fopen('status.html', 'r');
var_dump($res);
var_export($res); Result:

resource(2) of type (stream)
NULL

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/328116.htmlTechArticleThe problem was found when tracking yratings_get_targets, error_log(var_export(yblog_mspconfiginit("ratings"),true)); old It prints out the return value of yblog_mspconfiginit("ratings") which is NULL...
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Issues
php data acquisition?
From 1970-01-01 08:00:00
0
0
0
PHP extension intl
From 1970-01-01 08:00:00
0
0
0
How to learn php well
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template