Re: [PHP] simplexml problem



On Dec 31, 2007 10:09 AM, Dani Castaños <danitao.mailists@xxxxxxxxx> 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


Relevant Pages

  • Re: Invalid CastException with SqlDBType
    ... Add(string*, SqlDbType, int, string**) ... The DateTime.Now is trying to cast into a int. ... not in Sql set up the column as identity and let it seed itself. ... > update a MS SQL Database with a stored procedure. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Porting up to VC++ 2005
    ... Since you are dealing with strings that contain file names, ... characters, but that's a different question to be handled in a different way. ... done, which should be unnecessary, it should be an LPTSTR cast, which ... It only applies to string and ...
    (microsoft.public.vc.mfc)
  • Re: Confused about using Reflection to examine a collection
    ... the precise type that Reflection is saying it is. ... say that 'obj' is actually a custom collection. ... If it were a basic type, such as 'string' then I would do a cast like this: ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: TRUE and FALSE are treated differently
    ... No -- you can't echo a boolean in PHP. ... the boolean is implicitly cast to a string. ... If you look up the manual on type casting, you'll find that FALSE is cast to an empty string, and TRUE is cast to a non-empty string. ...
    (comp.lang.php)
  • Re: Error whilst processing ORDER BY clause
    ... My guess would be that you need to CAST it to a boolean since it is assuming ... > We receieve the error "Error whilst processing ORDER BY clause in the SQL ... name in the clause to reference a string or int data type it also succeeds, ... Can we use a CAST ...
    (microsoft.public.exchange2000.applications)