Web lists-archives.com

[PHP] unset array




Happy new year folks,

maybe I drunk to much wine and champain or I sit on my line, but  I  can
not more unset an array.  Here a sniplet:

----8<------------------------------------------------------------------
function siteIndexBar() {
  $strg[0] = "Home|/?what=index";
  $strg[1] = "Products";
  $strg[2] = "About|/?what=about";
  $strg[3] = "Impressum";
  $strg[4] = "Contact";
  return $strg;
}
----8<------------------------------------------------------------------

the returned string is the $contents in the following sniplet:

----8<------------------------------------------------------------------
    if (is_array($contents)) {
      foreach ($contents as $line) {
        $pieces = explode("|", $line);
        if ( empty($pieces[1]) ) {
          $output .= "<li class=\"createBoxITEM\">" . $pieces[0] . "</li>\n";
        } else {
          $output .= "<li class=\"createBoxITEM\"><A href=\"" . $pieces[1] . "\">" . $pieces[0] . "</li>\n";
        }
        unset($pieces);
      }
    } else {
      $output .= "<li class=\"createBoxITEM\">" . $contents . "</li>\n";
    }
----8<------------------------------------------------------------------

The second output "Products" get also the $pieces[1] from "Home".

Note:   The "empty($pieces[1])" is also not working and if I try
        to use "$pieces[0] = "";" it is not working either.

Any ideas how to get the knot out of my brain or make it better?

Have a nice day

-- 
Michelle Konzack        ITSystems
GNU/Linux Developer     0033-6-61925193

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php