Communities for your favorite technologies. Explore all Collectives
Stack Overflow for Teams is now called Stack Internal. Bring the best of human thought and AI automation together at your work.
Bring the best of human thought and AI automation together at your work. Learn more
Find centralized, trusted content and collaborate around the technologies you use most.
Stack Internal
Knowledge at work
Bring the best of human thought and AI automation together at your work.
stdClass Object ( [tip1] => Array ( [text] => <p>Test text</p> [format] => 1 ) )
I am trying to loop of object of objects with array
for ($i=1;$i<=10;$i++) { echo $fromform->{'tip$i'}['text']; }
never worked?
Use double quotes,
echo $fromform->{"tip$i"}['text'];
Or like this wiht single quotes,
$fromform->{'tip'.$i}['text'];
Add a comment
php variables never get parsed within single quoted
replace it with double quote
for ($i=1;$i<=10;$i++) { echo $fromform->{"{tip$i}"}['text']; }
Required, but never shown
By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.
Start asking to get answers
Find the answer to your question by asking.
Explore related questions
See similar questions with these tags.