Re: Object Type Casting

From: Date: Wed, 24 Apr 2013 16:45:24 +0000
Subject: Re: Object Type Casting
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-67133@lists.php.net to get a copy of this message
There are no concrete plans no. Object casting is typically available to please the static type checker. This concern does not exist in PHP since types are checked at runtime. So my first question would be: Why do you need it ? Other questions include: what would it do for up-casting, down-casting, and also casting to incompatible objects? How will it handle private properties? Best, On Wed, Apr 24, 2013 at 6:40 PM, Raymond Irving <xwisdom@gmail.com> wrote: > Hello, > > Are there any plans to add object type casting support in PHP? > > For example: > $circle = (Circle) ShapeFactory::createShape('circle'); > $circle->radius = 10; > echo $circle->getArea(); > > It would be great if this feature could be added to 5.5 :) > > __ > Raymond Irving > -- Etienne Kneuss http://www.colder.ch

« previous php.internals (#67133) next »