Page 1 of 1

fwrite-opposite function of parse_ini_file()

Posted: Wed Feb 02, 2011 2:35 am
by priyanob
How can we write to a file line by line using fwrite. Is there any opposite action function for parse_ini_file() ? Please help.

Re: fwrite-opposite function of parse_ini_file()

Posted: Wed Feb 02, 2011 12:10 pm
by Jade
http://php.net/manual/en/function.fwrite.php

Not sure what you mean by the opposite of parse_ini_file. You can't swap php_ini files on the fly.

Re: fwrite-opposite function of parse_ini_file()

Posted: Wed Feb 02, 2011 1:31 pm
by anantha
if you send line by line and use fwrite or file_put_contents..it will do it for you...for eg for each line you can call fwrite...not sure this is what u want..

Re: fwrite-opposite function of parse_ini_file()

Posted: Wed Feb 02, 2011 6:40 pm
by VladSun
The OP wants

Code: Select all

fwrite_opposite_function_of_parse_ini_file($fileName, parse_ini_file($fileName));
to keep the $fileName file unchanged :)

Sorry no such function. You may wish to write it yourself. I think it's not so hard.

Re: fwrite-opposite function of parse_ini_file()

Posted: Wed Feb 02, 2011 6:42 pm
by VladSun
Jade wrote:You can't swap php_ini files on the fly.
Not sure what you mean by that. parse_ini_file() just takes a file (any file, not php.ini) and parses it.

Re: fwrite-opposite function of parse_ini_file()

Posted: Thu Feb 03, 2011 10:19 am
by Jade
Haha I totally read the manual wrong. Reading FAIL.