Jump to content

extacting code from array.


purencool

Recommended Posts

Below is a while loop that dynamically generates about ten if statements. But I have know idea how to get the if statements is go through the php engine. I know I have to implode the array.l but what do I do next  ?

 

                // sets the path
                $x = $subdir.$folderItem;
               // put into if into array
                $folderContents[] =
                 "if($getVar == $folderItem){
                    include( $x);
                 }";

 

This is the code that implodes the arrays

function ShowPage($menuArray) {
  // This makes the selection for the page
      reset($menuArray);
    while (list($key,$value) = each($menuArray)) {
        if(!is_numeric($key)) {  //! means not, no need for extra else.
            if (is_array($value)) {
                $menuArray[$key]= implode($value);

            }
        }
    }
  $returnValue = implode($menuArray);
  return $returnValue;

}

Link to comment
https://forums.phpfreaks.com/topic/171586-extacting-code-from-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.