Reputation: 111
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};
?>
Upvotes: 1
Views: 33
Reputation: 957
You can access a dynamic property name like this:
<?php
$i = "1";
echo $row->{'test_column_' . $i};
Upvotes: 2