次のコードがあります。
$b = $br->b;
var_dump($b);
$iCountBlock = count($b);
ここで、b は SimpleXMLElement オブジェクトです。var ダンプの出力:
object(SimpleXMLElement)[16]
public 'blockID' => string '160999' (length=6)
public 'blockDesc' => string 'Description' (length=37)
public 'moduleID' => string '1' (length=1)
public 'pubID' =>
object(SimpleXMLElement)[18]
public 'contentID' => string '93305' (length=5)
public 'linkToPageID' =>
object(SimpleXMLElement)[19]
public 'moduleFunction' => string 'replaceHTML' (length=11)
public 'moduleVars' =>
object(SimpleXMLElement)[20]
public 'c' =>
object(SimpleXMLElement)[21]
public 'contentID' => string '93305' (length=5)
public 'contentType' => string '1' (length=1)
public 'description' => string 'new.usdish.com index redesign content' (length=37)
public 'content' =>
object(SimpleXMLElement)[22]
ただし、$iCountBlock は 1 に設定されます... オブジェクトのすべてのパブリック プロパティを適切にカウントしていないようです。また、 foreach ループを使用して b の各プロパティをループしようとしましたが、ループに入ることさえありませんでした。
foreach($b as $key => $val) { ... }
何が起こっているのかわからないので、ここでちょっと途方に暮れています。何かご意見は?