Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

entire php array save as string

Is there a way to make the whole array content and make it a string so that i can save it. the string i want to save is same with the output of print_r( $Array ) function.

Array ( 
    [0982385099] => Array ( 
         [Title] => The Key of Life; A Metaphysical Investigation
         [ISBN] => 0982385099 
         [Author] => Randolph J. Rogers 
         [SalesRank] => 522631 ...

I'dd like to have that kind of string saved on a different file( a txt or php file) which will be made by the program that I'm doing.

like image 253
JCm Avatar asked Nov 28 '22 10:11

JCm


1 Answers

$str = var_export($array, true);
like image 174
zerkms Avatar answered Dec 01 '22 01:12

zerkms