Jump to content

Referencing an array inside an array


Archimedees

Recommended Posts

 

According to script below. I set flag in $arParsedLines array to false then for  set flag for every $arParsedLines containing $arServerNames to true.

 

I get errors when doing this line

 

 

$arCurrentLine = $arParsedLines[$arCurrentServer];

    $arCurrentLine["active"] = true;

 

Please read script below to understand my point.

 

$arParsedLines = read_contents_pageconf("page.conf");

    //mark all lines inside $arParsedLines with active=false

    $i=0;

    $MaxParsedLines = count($arParsedLines);

    for($i=0; $i<$MaxParsedLines; $i++)

    {

      $arParsedLines[$i]["active"] = false;

    }

   

      //now mark all lines the user checked as active (active=true)

    //note: the lines the user checked are stored within $arLineNumbers

    $i=0;

    $nMaxServerNames = count($arServerNames);

   

    for ($i=0; $i<$nMaxServerNames; $i++)

    {

    $arCurrentServerName = $arServerNames[$i];

   

    $arCurrentLine = $arParsedLines[$arCurrentServer];

   

    $arCurrentLine["active"] = true;

   

    $arParsedLines[$arCurrentServerName] = $arCurrentLine;

    }//end for ($i=0; $i<$nLenLineNumbers; $i++)

 

  Wha is the correct way of achieving my aim??? Please help if you understand my probo. Thanks.

Link to comment
https://forums.phpfreaks.com/topic/79949-referencing-an-array-inside-an-array/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.