Example #1
0
        $this->whatnow = $g;
    }
    function printall()
    {
        echo "<h2 style='padding:0;margin:0 0 10px 0;'>What do you want to know?</h2>";
        echo "My full name is " . $this->FullName . "<br>";
        echo "My birthday is on " . $this->Birthday . "<br>";
        echo "My favorite song is " . $this->FavoriteSong . "<br>";
        echo "My personal favorite extra-curricular is " . $this->BestExtraCurricular . "<br>";
        echo "I am in the class of " . $this->GraduationYear . "<br>";
        echo "My favorite class is " . $this->favoriteClass . "<br><br>";
    }
    function __destruct()
    {
        echo $this->whatnow . " has been changed to another song<br><br>";
    }
    function __toString()
    {
        return "This is the class object, not some text to be just printed, so it IS important<br><br>";
    }
}
$reminder = new me("Jonathan Richard Zimmer", "March 14", "Fireflies by Owl City", "First Tech Challenge", 2018, "my computer class", "My favorite song");
$reminder->test();
$reminder->printall();
echo $reminder;
$reminder = "plant";
?>
</div>
</center>

Example #2
0
        echo self::$c, "\n";
        echo " this is static";
    }
    function test1()
    {
        $str = $this->str;
        $a = substr_replace($str, "uuuu", 2, 3);
        $b = str_replace("ell", 'wwww', $str);
        return array($a, $b);
    }
    function __destruct()
    {
    }
}
class iclass
{
}
//echo me::$c;
//me::t();
$a = new me('hello world');
$b = $a->test();
//var_dump($b);
//$af=strrev("meihao");
//var_dump($af);
$d = $a->test1();
//var_dump($d);
$email = "meihao@@126.com";
$url = "http://www.baidu.com";
$r = filter_var($email, FILTER_VALIDATE_EMAIL);
$rr = filter_var($url, FILTER_VALIDATE_URL);
var_dump($r, $rr);