On Fri, 21 Feb 2003, Ilia A. wrote: > On February 21, 2003 09:38 am, Sascha Schumann wrote: > > > implode) and fclose. However, IMO this wrapper is very useful since it > > > simplifies commonly used code a great deal and even makes it slightly > > > faster since the wrapper is in C rather then in PHP. > > > > Oh, come on. Put it into a utility library; this does not > > belong into the core of PHP. Or is your argument "we already > > have so much bloat, a bit more is ok, too"? > > This is merely a proposal, which anyone can support or not. Your choice is > obviously the latter and that's fine, I do want to make it clear why I do > want to see is part of PHP, whether my reasoning has merit or not is up to > each person to decide for themselves. If other developers feel the same way > you do, then this will definitely not be added and we'll have a precedent in > the event someone else notices file_get_contents() and decides to write a > function with opposing functionality.
This isn't quite the same as file_get_contents(). That function replaces this typical newbie PHP blurb: $file = file($filename); $str = implode('',$file); Which is amazingly inefficient. Of course, the correct PHP implementation is: $fp = fopen($filename,'r'); $string = fread($filename,filesize($filename)); fclose($fp); but even that is pretty verbose. I do agree with Sascha that file_put_contents() as it is currently proposed is useless. People aren't currently writing inefficient code to emulate this behaviour so we aren't fixing a file/implode fiasco here. We do not need a core function to replace fopen(); fputs(); fclose(). Now, as Sascha said, if file_put_contents() was actually smart and was able to atomically create a file with the given contents and handle common error conditions intelligently, then I am all for it. -Rasmus -- PHP Development Mailing List <http://www.php.net/> To unsubscribe, visit: http://www.php.net/unsub.php