Re: SimpleXML and the Single String (SOLVED)
| From: | Jay Blanchard | Date: | Wed, 22 Feb 2012 20:34:14 +0000 |
| Subject: | Re: SimpleXML and the Single String (SOLVED) | ||
| References: | 1 2 3 4 5 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-316762@lists.php.net to get a copy of this message | ||
>> I don't really see a need to add an extra layer or class extension
>> when casting works fine. Am I wrong? Why add several lines of code in
>> an extension class?
>>
> To keep the code readable?
>
> $value = $xml->node;
>
> vs.
>
> $value = (String)$xml->node;
>
> I like the first one. Plus you handle it to dynamically to the right type
>
> function __get($value)
> {
> if is float return float casted value
> if is boolean ...
> and so on
> }
The code is no less readable my way, YMMV