note 74832 rejected from function.file-put-contents by nicobn
| From: | nicobn@php.net | Date: | Sun, 08 Jul 2007 05:53:05 +0000 |
| Subject: | note 74832 rejected from function.file-put-contents by nicobn | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-128293@lists.php.net to get a copy of this message | ||
Note Submitter: judas dot iscariote at nodamnspam dot gmail dot com
----
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. ;-)