如何在php递归函数中使用数组

如何在php递归函数中使用数组,php,multidimensional-array,Php,Multidimensional Array,我试图在多维数组中找到类似的标题并打印这些标题 阵列转储: PHP代码: 函数getrecursiveValues($start、$arrayValues、$totalCount、$previousTitle、$newtotalCount=0) { $currentTitle=$ArrayValue[$i]['Title']; if($currentTitle==“全景基础图像”){ 印刷费($newAray); } 对于($i=$start;$i=$newtotalCount) getrecu

我试图在多维数组中找到类似的标题并打印这些标题

阵列转储: PHP代码: 函数getrecursiveValues($start、$arrayValues、$totalCount、$previousTitle、$newtotalCount=0) { $currentTitle=$ArrayValue[$i]['Title']; if($currentTitle==“全景基础图像”){ 印刷费($newAray); } 对于($i=$start;$i<$newtotalCount;$i++){ echo“i是$i新的totalcount是$newtotalCount”; 如果($newtotalCount!=0)和($i==($newtotalCount-1))){ 回声“
在iffffffffffffffffffffffffffffff
”中; $currentTitle=$ArrayValue[$i]['Title']; $previousTitle=$ArrayValue[$i-1]['Title']; 如果($previousTitle==$currentTitle){ 回显“Sameeeee”。$currentTitle。“
”; 破口1; }否则{ 破口1; } }否则{ 回声“
在elseee中
”; $currentTitle=$ArrayValue[$i]['Title']; 如果($i==0){ 回显“$currentTitle”; } 如果($i!=$start) $previousTitle=$ArrayValue[$i-1]['Title']; echo“上一个val为--$previousTitle”; 如果($previousTitle==$currentTitle){ 回显“Sameeeee”。$currentTitle。“
”; }否则{ $nn=计数($ArrayValue); echo“
从函数total isss$totalCount中调用递归--
”; $newtotalCount=0; $newAray=array\u slice($arrayvalue,$i); $newtotalCount=计数($newAray); $previousTitle=$newAray[0]['Title']; 如果($totalCount>=$newtotalCount) getrecursiveValues(0、$newAray、$newtotalCount、$previousTitle、$newtotalCount); 其他的 返回; } } } 呼应“出局”; 返回“再见”; 出口 }
我无法从for和out函数中出来,有人能帮我吗?

如果我拼写错误,您是否尝试过使用类似的方法对不起

function recursive($array) {
   foreach($arrays as $array) {
    if(is_array($array) == true) 
       $array = recursive($slimer aray);
     } else {
       //do what ever you gotta do
   }
  }
}
function getrecursiveValues($start, $arrayValues, $totalCount, $previousTitle, $newtotalCount = 0)
{
  $currentTitle = $arrayValues[$i]['Title'];
  if ($currentTitle == "Panorama Base Images") {
    print_r($newAray);
  }


  for ($i = $start; $i < $newtotalCount; $i++) {
    echo "<h1> i is $i  new totalcount is $newtotalCount </h1>";
    if (($newtotalCount != 0) && ($i == ($newtotalCount - 1))) {
      echo "<br />in ifffffffffffffffffffffffffffff<br />";
      $currentTitle  = $arrayValues[$i]['Title'];
      $previousTitle = $arrayValues[$i - 1]['Title'];

      if ($previousTitle == $currentTitle) {
        echo "sameeeeee" . $currentTitle . "<br />";
        break 1;
      } else {
        break 1;
      }

    } else {
      echo "<br />in elseee<br />";
      $currentTitle = $arrayValues[$i]['Title'];
      if ($i == 0) {
        echo "<h1>  $currentTitle</h1>";
      }

      if ($i != $start)
        $previousTitle = $arrayValues[$i - 1]['Title'];
      echo "previous val is  -- $previousTitle";

      if ($previousTitle == $currentTitle) {
        echo "sameeeeee" . $currentTitle . "<br />";            
      } else {
        $nn = count($arrayValues);
        echo "<h2><br /> calling the recursivie from the function total isssssss $totalCount---- </h2> <br />";

        $newtotalCount = 0;
        $newAray       = array_slice($arrayValues, $i);
        $newtotalCount = count($newAray);

        $previousTitle = $newAray[0]['Title'];

        if ($totalCount >= $newtotalCount)
          getrecursiveValues(0, $newAray, $newtotalCount, $previousTitle, $newtotalCount);
        else
          return;

      }
    }

  }
  echo "<h1> Out of for</h1>";
  return "bye";
  exit;  
}
function recursive($array) {
   foreach($arrays as $array) {
    if(is_array($array) == true) 
       $array = recursive($slimer aray);
     } else {
       //do what ever you gotta do
   }
  }
}