Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
echo $xml->SLOT1->Effect; echo $xml->SLOT2->Effect; echo $xml->SLOT3->Effect;
forループを使用してこれを単純化する方法はありますか? 私はこれを試しましたが、何もエコーしません:
for
for ($x = 1; $x <= 3; $x++) { echo $xml->SLOT[$x]->Effect; }
使用できます
$xml->{"SLOT".$x}->Effect;
for ($x = 1; $x <= 3; $x++) { echo $xml->{SLOT.$x}->Effect; }