dimanche 31 janvier 2021

php __destruct why get different result by file_get_contents

the content in hint.php is "111"

<?php

class T{
    public $filename = "hint.php";

    function __destruct() {
        var_dump(file_get_contents($this->filename));
    }
}

new T();

this got

string(3) "111"

And when I set a variable $t, the result will be different.

$t = new T();

this got

string(0) ""

why this happend




Aucun commentaire:

Enregistrer un commentaire