Re: SimpleXMLElement Object into array



..oO(rodeored)

How do I put the value of an SimpleXMLElement Object into any array

If $title is SimpleXMLElement Object ( [0] => Mother )

how do I get "Mother" and put it in an array ? ;

if I echo $title, it says "Mother" but if I put it in an array
$myarray=array($title);
the array is Array ( [0] => SimpleXMLElement Object ( [0] =>
Mother ) )
I don't want that I want
Array ( [0] =>Mother) )

To access a SimpleXMLElement's content you have to cast it to a string.
Sometimes this happens automatically, for example if you print it out or
use any other function that accepts strings values, in cases like above
you have to cast explicitly.

Micha
.



Relevant Pages

  • oo code
    ... I've got a prototype-defined method: ... lookup function for Arrays. ... The next iteration of my code will probably have a sort of 'mother' ... object that has an Array of objects as a member and then have the ...
    (comp.lang.javascript)
  • SimpleXMLElement Object into array
    ... How do I put the value of an SimpleXMLElement Object into any array ... how do I get "Mother" and put it in an array? ... if I echo $title, it says "Mother" but if I put it in an array ...
    (comp.lang.php)
  • arrays in arrays
    ... Have a 2D array where each element contain a new 2D ... Is it possible to perform a 'Redim Preserve' on an ... array contained in the "mother" array? ...
    (microsoft.public.excel.programming)
  • Re: Need A function which...
    ... broadcast on comp.lang.php: ... array (or a string). ... echo $y // suppose to return 10 ...
    (comp.lang.php)
  • Re: [PHP] Variable as an index
    ... $users is an array and you are trying to simply put it in a string. ... to be undefined ergo it's not printing anything. ... echo " ...
    (php.general)