How to store php array to text -


i have php array this.

$config['sample'] = array( 'key1' => 'val1', 'key2' => 'val2' ); 

and want value in $config['sample'] write in text file this.

$newcfg['sample'] = array( 'key1' => 'val1', 'key2' => 'val2' );

how convert php array value text string before write text file?

ps. 1. cannot use serialize because when write file, must ready use in php same $config['sample'] value.

ps. 2. cannot use json encode/decode also. same reason cannot use serialize.

use var_export works. @fr4nk

you looking var_export. exports variable executable php code. write text file.


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

javascript - jQuery .height() return 0 when visible but non-0 when hidden -