0 && $M > 0 )
{
$M–;
$X = trim(array_shift( $R ));
foreach( $G[$X] as $Y )
{
$Y = trim($Y);
// See if we got a solution
if ( $Y == $B )
{
// We did? Construct a result path then
array_push( $P, $B );
array_push( $P, $X );
while ( $V[$X] != $A )
{
array_push( $P, trim($V[$X]) );
$X = $V[$X];
}
array_push( $P, $A );
return array_reverse( $P );
}
// First time we visit this node?
if ( !array_key_exists($Y, $V) )
{
// Store the path so we can track it back,
$V[$Y] = $X;
// and add it to the "within reach" list
array_push( $R, $Y );
}
}
}
return $P;
}
$time_start = microtime_float();
//Database structure:
// E_systems
// regionId constellationId systemName systemId jumpNodes security
// (INT) (INT) (CHAR) (INT) (CHAR, Jump1:Jump2:Ju..) (CHAR)
//Declare arrays to hold Solar System data
//
//Structure :
// $nameArray : (ARRAY[ID] = NAME)
// $jumpArray : (ARRAY[NAME] = ARRAY[JUMPS])
// $idArray : (ARRAY[NAME] = ID)
$nameArray = array();
$jumpArray = array();
$idArray = array();
//Populate $jumpArray
$query="SELECT * FROM e_systems";
$result=mysql_query($query);
$previousSystem = "";
$arrayContent = "";
while ($row=mysql_fetch_row($result)) {
$regionId = trim($row[0]);
$constId = trim($row[1]);
$systemName = strtoupper(trim($row[2]));
$systemId = trim($row[3]);
$secStatus = trim($row[5]);
$nameArray[$systemId][0] = $systemName;
$nameArray[$systemId][1] = $regionId;
$nameArray[$systemId][2] = $constId;
$nameArray[$systemId][3] = $secStatus;
$idArray[strtoupper($systemName)] = $systemId;
$jumpArray[$systemName]= explode(":", strtoupper($row[4]));
array_push($jumpArray[$systemName],$systemId);
}
header("Content-type: text/xml");
$xml_output = "\n\t