Welcome Guest, Not a member yet? Register   Sign In
returning multidimensional array
#1

[eluser]Todlerone[/eluser]
Hello all and TY in advance for any help/suggestions. I have some code that I re-use quite alot. I tried to create a function within my class to call. It does work but I only get one value and not the hundreds that I expect. Here is the code I want to re-use.

Code:
switch($unit){
   case 'Cyberknife':
      if ($ps['treat_unit'] == "Cyberknife"){
         $rangeSEL[$data['year']][$brainDIAG] +=1;
      }
      break;

   case 'Trilogy':
      if ($ps['treat_unit'] == "Trilogy"){
        $rangeSEL[$data['year']][$brainDIAG] +=1;
      }
      break;

   case 'Both':
      if (($ps['treat_unit'] == "Cyberknife") || ($ps['treat_unit'] == "Trilogy")){
         $rangeSEL[$data['year']][$brainDIAG] +=1;
      }
      break;
}
I tried this function call
Code:
$rangeSEL=$this->chartshow($unit, $ps['treat_unit'], $brainDIAG, $data['year']);
with this function.
Code:
function chartshow($unitPOST, $unitDB, $holder, $year){
  switch($unitPOST){
   case 'Cyberknife':
    if ($unitDB == "Cyberknife"){
     $SEL[$year][$holder] +=1;
    }
    break;
   case 'Trilogy':
    if ($unitDB == "Trilogy"){
     $SEL[$year][$holder] +=1;
    }
    break;
   case 'Both':
    if (($unitDB == "Cyberknife") || ($unitDB == "Trilogy")){
     $SEL[$year][$holder] +=1;
    }
    break;
  }
  return $SEL;
}

TY....




Theme © iAndrew 2016 - Forum software by © MyBB