I have function like this:
function getTree($r, $html) {
foreach ($r as $entry) {
if (count($entry['children']) == 0) {
$html .= '<li>' . $entry['parent_entry_id'] . '</li>';
} else {
getTree($entry['children'], $html);
}
//var_dump($html);
}
return $html;
}
If I call it like this
$html = '';
$dzoni = getTree($results, $html);
echo $dzoni;
E expect to get few list elements But I get empty string. It is not problem with the data. If I var_dump them I get the result. But result does not concatenate all the time. It simply stops at some point. var_dump example:
C:\wamp64\www\co_3\regular_view.php:72:string '<li>17</li>'
C:\wamp64\www\co_3\regular_view.php:72:string '<li>17</li><li>18</li>'
C:\wamp64\www\co_3\regular_view.php:72:string '<li>22</li>'
What am I doing wrong?