• 0
Votes
name

A PHP Error was encountered

Severity: Notice

Message: Undefined index: userid

Filename: views/question.php

Line Number: 191

Backtrace:

File: /var/www/html/cnasolution/site/application/views/question.php
Line: 191
Function: _error_handler

File: /var/www/html/cnasolution/site/application/controllers/Questions.php
Line: 419
Function: view

File: /var/www/html/cnasolution/site/index.php
Line: 315
Function: require_once

name Punditsdkoslkdosdkoskdo

Build array with recursive php function

I have a hierarchy or rooms and subrooms without a universal array mapping it out. Instead I connect the ids of parent to child. So I need to use a recursive php function to loop through subrooms of a room and the subrooms of each of those and on an on and then build an array of all their ids

If I were just going to output each id as a string, I'd do it like this

function get_all_child_subrooms_recursive($rid) {     $subrooms = get_all_subrooms($rid); // a function that grabs an array of direct children room id's to the parent room ($rid)     if ($subrooms == "") {         return;     } else {         foreach ($subrooms as $subroom) {             $rid = $subroom;             echo $rid .',';             get_all_child_subrooms_recursive($rid);         }     } } 

But I need this data returned as a flat array containing all the id's

Download script demo [LINK] [Origin]
Download script demo [LINK 2] [Onedrive] Download script demo [LINK 2] [Google drive]