Menu
Can I typecast variables to particular kinds of objects? For example:
[code]class Shape {}
class Circle extends Shape {}
$o = new Circle();
// From here on out, $o should be an instance of Shape as far as PHP is concerned
$o = (Shape)$o;
The only solution I’ve found so far is to serialize the object, manipulate the string, then unserialize. But this seems less than ideal. Is there a better way?