I have a simple function checkReplies() which checks the reply_id and if the reply_id is not equal to 0, calls himself and checks again. Now I need to create a array ffor the outputs it generate, but I am unable to do it, the array outputs only the last element
function checkReplies( $rnid ){
$r_notes = array();
include_once('include/class.dbc.php');
$dbo=new dbc();
$db=$dbo->dbconnect();
if( $rnid > 0 ):
$qry_rn = "SELECT note_subject,note_body,reply_note_id FROM tbl_notes WHERE note_id = '$rnid' ORDER BY note_date DESC";
$rslt_rn = $dbo->executeQuery( $qry_rn );
$reply = '<p style="border : none;">';
$reply .= $rslt_rn[0]['note_subject'].'<br />'.$rslt_rn[0]['note_body'];
$reply .= '('.$rslt_rn[0]['reply_note_id'].')';
$reply .= '</p>';
echo $reply;
$r_notes[] = $reply;
checkReplies( $rslt_rn[0]['reply_note_id'] );
endif;
return $r_notes;
}
$display = checkReplies( $rnid );
var_dump($display);
How to create the array of the outputs ?