1

Normally i use this code and it's will be echo work good.

<?PHP 
echo $row->test_column_1;
?>

But when i tyied to use this code, it's not echo any data. How can i do ?

<?PHP
$i = "1";
echo ${'row->test_column_' . $i};
?>
2

1 Answer 1

2

You can access a dynamic property name like this:

<?php
$i = "1";
echo $row->{'test_column_' . $i};
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

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.

Ask question

Explore related questions

See similar questions with these tags.