filter possibilities within a multidimensional array PHP/Codeigniter
The main question is why you want a recursive function?This is a solution without recursive-ness.
public function _combine_bets($array) { $result = ''; foreach($array['bets'] as $bet) { $result .= $bet; }// returns stringreturn $result;}
What do you want returned? Why do you need a recursive function?
I don't understand the question.
I made the impossible thing possible, don't ask me how!
function _combine_bets($array, $curBet = null, $currentRow = null){ $cur = array_shift($array); $result = array(); if(!isset($currentRow)) $currentRow = $curBet; else $currentRow .= $curBet; if(!count($array)) { foreach($cur['bets'] as $bet) { $currentRow .= $bet; if(strlen($currentRow) == 13) $this->m_couponRows[] = $currentRow; $currentRow = null; } return $this->m_couponRows; } foreach($cur['bets'] as $bet) { $result[$bet] = $this->_combine_bets($array, $bet, $currentRow); } return $this->m_couponRows;}