コード例 #1
0
ファイル: phpPage.php プロジェクト: princess36rose/ccsd_stt
        echo "Grade: " . $this->grade . "<br>";
        echo "Class: " . $this->classs . "<br>";
        echo "Favorite Class: " . $this->favoriteClass . "<br><br>";
    }
    //do anything when object is shutdown/deleted
    function __destruct()
    {
        echo $this->firstName . " has been obliterated<br><br>";
    }
    //this is a fail safe to prevent a error if it is printed i think
    function __toString()
    {
        return "This is the student object not some text to be just printed<br><br>";
    }
}
echo "<h2>Create a new object from the student class</h2><br>";
$cat = new student("Max", "DeVos", "867-5309", 348, 11, 2017, "Chemistry");
echo "<h2>Run a test method</h2><br>";
$cat->test();
echo "<h2>Run a printall method for a student</h2><br>";
$cat->printall();
echo "<h2>Try to print the student object as text</h2><br>";
echo $cat;
echo "<h2>Activate the destruct function by giving the object the text value of 'dog'</h2><br>";
$cat = "dog";
?>
</div>
</center>

<?php 
makeFooter("Programing is Fun", 0, "True");