fwrite-opposite function of parse_ini_file()

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
priyanob
Forum Newbie
Posts: 6
Joined: Wed Dec 09, 2009 7:09 pm

fwrite-opposite function of parse_ini_file()

Post 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.
User avatar
Jade
Forum Regular
Posts: 908
Joined: Sun Dec 29, 2002 5:40 pm
Location: VA

Re: fwrite-opposite function of parse_ini_file()

Post 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.
anantha
Forum Commoner
Posts: 59
Joined: Thu Dec 23, 2010 7:38 pm

Re: fwrite-opposite function of parse_ini_file()

Post 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..
User avatar
VladSun
DevNet Master
Posts: 4313
Joined: Wed Jun 27, 2007 9:44 am
Location: Sofia, Bulgaria

Re: fwrite-opposite function of parse_ini_file()

Post 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.
Last edited by VladSun on Wed Feb 02, 2011 6:42 pm, edited 1 time in total.
There are 10 types of people in this world, those who understand binary and those who don't
User avatar
VladSun
DevNet Master
Posts: 4313
Joined: Wed Jun 27, 2007 9:44 am
Location: Sofia, Bulgaria

Re: fwrite-opposite function of parse_ini_file()

Post 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.
There are 10 types of people in this world, those who understand binary and those who don't
User avatar
Jade
Forum Regular
Posts: 908
Joined: Sun Dec 29, 2002 5:40 pm
Location: VA

Re: fwrite-opposite function of parse_ini_file()

Post by Jade »

Haha I totally read the manual wrong. Reading FAIL.
Post Reply