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.
stdClass Object ( [tip1] => Array ( [text] => <p>Test text</p> [format] => 1 ) )
オブジェクトのオブジェクトを配列でループしようとしています
for ($i=1;$i<=10;$i++) { echo $fromform->{'tip$i'}['text']; }
働いたことがない?
一重引用符内でphp変数が解析されることはありません
二重引用符に置き換えます
for ($i=1;$i<=10;$i++) { echo $fromform->{"{tip$i}"}['text']; }