Re: unset array

From: Date: Sun, 01 Jan 2017 13:01:26 +0000
Subject: Re: unset array
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-325924@lists.php.net to get a copy of this message
OK, it was the alcohol last night! Forgotten the </A> to close the links! Have a nice day! On 2017-01-01 13:49:15 Michelle Konzack hacked into the keyboard: > 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 -- Michelle Konzack ITSystems GNU/Linux Developer 0033-6-61925193

« previous php.general (#325924) next »