Page 1 of 1

Syntax Problem.

Posted: Mon Oct 13, 2008 7:07 am
by leathem
Hello all,
i have a problem with a line of code, i have a multi dimensional array, i want to compare each value in each array to another and display a match. When the code is executed it compares all elements of all 3 arrays in the multidimensional array at once instead of goin through each array at a time, hope this is clear.
Heres The code

Code: Select all

unction summaryDisplay($dir_name, $filter, $rss)
{
  global $config;
  $groups = ($config["groups"]);
  $groupsArray = explode(' ', $groups);
  
 
 
  $projectsArrays = array();
  
  for($i = 0; $i < count($groupsArray); $i++)
  {
    $projectsArrays[$i] =  explode(' ', ($config[$groupsArray[$i].".projects"])); 
    echo "<test1>". $projectsArrays [$i][0]."</test1>";
  }
 
 
  for ($i = 0; $i < count($groupsArray); $i++){
        foreach ($projectsArrays as $tempZ) {  
 
        foreach ($tempZ as $tempA) {
        
          #displays the results  
          if ($tempA == $file_name) {  
            echo "<".$groupsArray[$i].">";
            echo "<project><name>".$file_name."</name><status>${status}</status>";
            echo "<latestresult>".$lastResult."</latestresult>";
            echo "<latestsuccess>".$lastSuccessfulBuild."</latestsuccess>";
            echo "<latestattempt>".($lastAttempt !== "" ? date($config["dateformat"], $lastAttempt) : "")."</latestattempt>";
            echo "<latestlabel>".$lastLabel."</latestlabel>";
            echo "<latestlog>".$lastLog."</latestlog>";
            echo "</project>";
            echo "</".$groupsArray[$i].">\n";
            
            
      if( $lastResult == "SUCCESS" )
        {
          $successCount++;
        }
      else if( $lastResult == "FAILURE" )
        {
          $failureCount++;
        }
            
          }//if
         }//foreach
      
      }//foreach
 

Re: Syntax Problem.

Posted: Mon Oct 13, 2008 6:58 pm
by califdon
Check for "compare" in the descriptions of these array functions:
http://us2.php.net/array