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
smadonnatore
Forum Newbie
Posts: 1 Joined: Fri Dec 30, 2011 5:29 pm
Post
by smadonnatore » Fri Dec 30, 2011 5:36 pm
I'm going mad.
Here it is a single line code snippet
Code: Select all
<?php
file_put_contents("/var/www/test/" . rand() . ".html", "test");
?>
It should create 1 file with content "test", but every times it's executed it creates 2 files with the same content.
How is it possible?
Thanks.
twinedev
Forum Regular
Posts: 984 Joined: Tue Sep 28, 2010 11:41 am
Location: Columbus, Ohio
Post
by twinedev » Sat Dec 31, 2011 12:50 am
As is, the code above would not do that. How is that line of code (and/or the file it is in) called?
-Greg
gameraider
Forum Newbie
Posts: 6 Joined: Thu Dec 29, 2011 6:14 am
Post
by gameraider » Sat Dec 31, 2011 4:29 am
smadonnatore wrote: I'm going mad.
Here it is a single line code snippet
Code: Select all
<?php
file_put_contents("/var/www/test/" . rand() . ".html", "test");
?>
It should create 1 file with content "test", but every times it's executed it creates 2 files with the same content.
How is it possible?
Thanks.
Did you set the FILE_APPEND flag ??