Return to Snippet

Revision: 11931
at February 24, 2009 05:12 by pollux


Initial Code
class MyObject {
    /**
     * @param MyObject $object
     * @return MyObject
     */
    static public function cast(MyObject $object) {
        return $object;
    }
}

$myObject = MyObject::cast($_SESSION["myObject"]);

Initial URL
http://ch.php.net/manual/en/language.types.type-juggling.php#language.types.typecasting

Initial Description
Usefull for IDE autocompletion

Initial Title
Cast a user defined object

Initial Tags


Initial Language
PHP