在std对象php中加入变量

I have below code questions and answers,

<?php
foreach ($ques_perso as $q) {
?>
<div class="row">
   <div class="col-md-12">
      <div class="form-group">
         <label class="control-label"><?php echo $q['ques_text'] ?><span class="required"> * </span></label>
         <textarea class="form-control" id="ques_<?php echo $q['ques_id'] ?>" name="ques_<?php echo $q['ques_id'] ?>" autocomplete="off" rows="3" readonly><?php echo $answers->ques_X; ?></textarea>
       </div>
    </div>
</div>
<?php
} ?>

This is code for 10 question and its answer.

I have $answers object as below,

stdClass Object
(
[ans_id] => 1
[user_id] => 1
[ques_1] => check1
[ques_2] => check2
[ques_3] => check3
[ques_4] => check4
[ques_5] => check5
[ques_6] => check6
[ques_7] => check7
[ques_8] => check8
[ques_9] => check9
[ques_10] => check10
)

Now i want to put this answers in textarea, but i could not able to put in by using above code..i can i use my answers like echo $answers->ques_X

Thank you,

Wow you have a question id as $q['ques_id'], now can change like this.

$answer_id = "ques_".$q['ques_id'];
<textarea class="form-control" id="ques_<?php echo $q['ques_id'] ?>" name="ques_<?php echo $q['ques_id'] ?>" autocomplete="off" rows="3" readonly><?php echo $answers->$answer_id; ?></textarea>

Not sure I fully understand the question but perhaps you could do something like this to display the contents of the $answers object.

$properties = get_object_vars( $answers );
foreach( $properties as $property => $value )echo $property.'='.$value;