Re: [RFC] __debug_info()
| From: | Crypto Compress | Date: | Tue, 21 Jan 2014 22:18:14 +0000 |
| Subject: | Re: [RFC] __debug_info() | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-71391@lists.php.net to get a copy of this message | ||
Hi,
why not use __toString?
class File {
// "Resource(stream)" isn't all that useful
private $fp;
// But all the stream meta data is
public function __toString() {
return $this->fp ? print_r(stream_get_meta_data($this->fp), true) : ''; // var export, what ever you like
}
public function open($filename, $mode = 'r'){
$this->fp = fopen($filename, $mode);
}
}
$f = new File;
echo $f; // object(File)#1 { }
$f->open('http://php.net');
echo $f;
cryptocompress