note 74832 added to function.file-put-contents
| From: | judas dot iscariote at nodamnspam dot gmail dot com | Date: | Mon, 30 Apr 2007 08:10:51 +0000 |
| Subject: | note 74832 added to function.file-put-contents | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-125968@lists.php.net to get a copy of this message | ||
since php 5.2.1 $data can also be an object that implements the __toString() method..
<?php
class foo {
public function __toString()
{
return "write this";
}
}
file_put_contents(sys_get_temp_dir() . '/test.txt', new foo(), LOCK_EX);
?>
/tmp/test.txt will contain "write this" now. ;-)
----
Server IP: 200.73.8.42
Probable Submitter: 200.7.26.225
----
Manual Page -- http://www.php.net/manual/en/function.file-put-contents.php
Edit -- https://master.php.net/note/edit/74832
Del: integrated -- https://master.php.net/note/delete/74832/integrated
Del: useless -- https://master.php.net/note/delete/74832/useless
Del: bad code -- https://master.php.net/note/delete/74832/bad+code
Del: spam -- https://master.php.net/note/delete/74832/spam
Del: non-english -- https://master.php.net/note/delete/74832/non-english
Del: in docs -- https://master.php.net/note/delete/74832/in+docs
Del: other reasons-- https://master.php.net/note/delete/74832
Reject -- https://master.php.net/note/reject/74832
Search -- https://master.php.net/manage/user-notes.php