How to get tag names in xml using simple xml object
<p>Hi I have following simple xml object:</p>

<pre><code>[ad] =&gt; Array
    (
        [0] =&gt; SimpleXMLElement Object
            (
                [title] =&gt; &lt;b&gt;Title: Mysql 1&lt;/b&gt;
                [abstract] =&gt; Abstract: Mysql 1
                [url] =&gt; www.Mysql.com
                [rurl] =&gt; http://sample/xtrack.php?rurldata=yes
                [iurl] =&gt; http://sample.com/
                [bid] =&gt; 0.0880
            )

        [1] =&gt; SimpleXMLElement Object
            (
                [title] =&gt; &lt;b&gt;Title: Mysql 2&lt;/b&gt;
                [abstract] =&gt; Abstract: Mysql 2
                [url] =&gt; www.Mysql.com
                [rurl] =&gt; http://sample/xtrack.php?rurldata=yes
                [iurl] =&gt; http://sample.com/
                [bid] =&gt; 0.1980
            )
    )
</code></pre>

<p>I want to create an array from this. I am trying in foreach like this</p>

<pre><code>foreach($xmlString-&gt;ad as $key){
        foreach($key as $key2 =&gt; $val2){
             $adData[$counter][$key2] = $val2;
        }
            $counter++;
}
</code></pre>

<p>But I get a structure like this:</p>

<pre><code> Array
  (
    [0] =&gt; Array
    (
        [title] =&gt; SimpleXMLElement Object
            (
                [0] =&gt; &lt;b&gt;Title: Mysql 1&lt;/b&gt;
            )

        [abstract] =&gt; SimpleXMLElement Object
            (
                [0] =&gt; Abstract: Mysql 1
            )

        [url] =&gt; SimpleXMLElement Object
            (
                [0] =&gt; www.Mysql.com
            )

        [rurl] =&gt; SimpleXMLElement Object
            (
                [0] =&gt; http://sample/xtrack.php?rurldata=yes
            )

        [iurl] =&gt; SimpleXMLElement Object
            (
                [0] =&gt; http://sample.com/
            )

        [bid] =&gt; SimpleXMLElement Object
            (
                [0] =&gt; 0.0880
            )

    )
    .
    .
    .So on
</code></pre>

<p>now I know that $key2 is an object. How can i retrieve only tag name of that ? How to go about this?</p>
