difference between var_dump and var_export

difference between var_dump and  var_export

Var_dump

void var_dump ( mixed expression [, mixed expression [, …]])

This function returns structured information about one or more expressions that includes its type and value. Arrays are explored recursively with values indented to show structure.

var_export

mixed var_export ( mixed expression [, bool return])

This function returns structured information about the variable that is passed to this function. It is similar to var_dump() with the exception that the returned representation is valid PHP code. Which can be save and used back.

difference between var_dump and var_export:

<?php

$a = array (1, 2, array (”a”, “b”, “c”));
var_export ($a);
/* outputs

array ( 0 => 1, 1 => 2, 2 => array ( 0 => ‘a’, 1 => ‘b’, 2 => ‘c’, ), )

*/

var_dump($a);

/*

array(3) { [0]=> int(1) [1]=> int(2) [2]=> array(3) { [0]=> string(1) “a” [1]=> string(1) “b” [2]=> string(1) “c” } }

*/

?>

Leave a Reply

You must be logged in to post a comment.


All material @ copyrighted by chrisranjana.com. If you want to link to this article you are welcome to do so. Unauthorized publication is strictly prohibited. This developer tutorial website contains articles by Php programmers , Software developers, Mysql programmers and asp c# programmers. This website also contains ajax tutorials and advanced mysql sql stored procedures and functions tutorials and sample codes.