If I have this array:
<?php
$myarray = Array
(
'keyword' => 'seo',
'title_factor' => false,
'description_factor' => false,
'headtags_factor' => false,
'imgalt_factor' => false,
'keyword_density' => 0,
);
var_dump($myarray);
print_r($myarray);
?>
Here is the output of vardump and print_r:
array(6) {
["keyword"]=>
string(3) "seo"
["title_factor"]=>
bool(false)
["description_factor"]=>
bool(false)
["headtags_factor"]=>
bool(false)
["imgalt_factor"]=>
bool(false)
["keyword_density"]=>
int(0)
}
Array
(
[keyword] => 'seo'
[title_factor] =>
[description_factor] =>
[headtags_factor] =>
[imgalt_factor] =>
[keyword_density] => 0
)
Here is what I want as output:
"Array
(
'keyword' => 'seo',
'title_factor' => false,
'description_factor' => false,
'headtags_factor' => false,
'imgalt_factor' => false,
'keyword_density' => 0,
);"
We can use var_dump() or print_r() to display the values of an array in human-readable format or to see the output value of the program array.
Syntax for indexed arrays: array(value1, value2, value3, etc.) Syntax for associative arrays: array(key=>value,key=>value,key=>value,etc.)
Use var_export()
[docs]:
$string = var_export($array, true);
You're searching for var_export
if I'm correct
more info about var_export at http://www.php.net/manual/en/function.var-export.php
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With