> On 23 Apr 2015, at 11:59, Michael Wallner <m...@php.net> wrote: > > Why not a ctor as in: > > function __construct ($filename, $buffer = null) { > if (isset ($ buffer)) { > // use $ buffer > } else { > // use file contents > } > } > > The file name parameter can be of use anyway for posted file contents from > buffer.
Looks good! So, it work like this (+ error handling) function __construct($filename, $buffer = null) { $this->filename = $filename; if (is_null($buffer)) { $this->data = file_get_contents($filename); } else { $this->data = buffer; } } А. -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php