I have a class, File, which handles file functions... I have File::replace($old, $new); which is working fine, but when I go to File::read(); after replace() is called, it wont output the file contents... Any ideas as to why?

Code PHP:
public function replace($old, $new, $all = false) {
    $pointer = $this->find($old, true);
    $tmp_name = $this->file.".tmp";
    $tmp = new File($tmp_name, $this->binary);
    $tmp->write($this->read(($pointer + strlen($old)), $this->size));
    if ($all && strpos($this->read(), $old)) {
        return $this->replace($old, $new, $all);
    } else {
        return true;
$f = new File("file.txt");
$f->write("some text.");
echo $f->read();
$f->replace("text", "more text");
echo $f->read();

there is no output... But file.txt when opened in a text editor says "some more text"

Any help would be greatly appreciated.

Also, I am reloading the file stream... I thought maybe that would do it, but nothing...

Code php:
public function write($data, $pos = null) {
    // calls File::reloadFile() after fwrite();
public function truncate($from = 0, $to = null) {
    // calls File::reloadFile() after ftruncate();
private function reloadFile() {
    $mode = "a+";
    if ($this->binary) {
        $mode .= "b";
    $this->fp = fopen($this->file, $mode);
    $this->details(null, true);