Re: simplexml problem
| From: | Nathan Nobbe | Date: | Mon, 31 Dec 2007 15:14:28 +0000 |
| Subject: | Re: simplexml problem | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-266428@lists.php.net to get a copy of this message | ||
On Dec 31, 2007 10:09 AM, Dani Castaños <danitao.mailists@gmail.com> wrote:
> Thanks! Problem fixed... But I think PHP must do the cast automatically.
> I think it's a bug fixed in a further version than mine as I've read
>
no problem; but just fyi, its not a bug; the behavior is as expected per the
manual:
http://us3.php.net/manual/en/ref.simplexml.php
*Example#6 Comparing Elements and Attributes with Text*
To compare an element or attribute with a string or pass it into a function
that requires a string,
you must cast it to a string using *(string)*. Otherwise, PHP treats the
element as an object.
if you use an operation that casts implicitly, such as echo, you dont have
to cast yourself;
otherwise you do :)
-nathan