Werbung: SecurityConsole.de verwaltet Ihre Computer mit Security Essentails aus der Cloud!
30 Tage kostenfrei testen und 20% Rabatt für Ihre Bestellung mit Promocode: WBF2685582
(Promocode gültig bis 31.12.2011)

Group:  English: Windows Server » microsoft.public.windows.server.scripting
Thread: Conflicting Behavior with Arrays

HTVi
TV Discussion Newsgroups

Conflicting Behavior with Arrays
"Bob Lamoureux" <bob[ at ]lamoureux.com> 6/4/2007 3:35:28 PM
I am having trouble getting consistent behavior with the following syntax

$array1 = [ at ]([ at ]('first set item 1', 'first set item 2', 'first set item3'),
[ at ]('second set item 1', 'second set item2', 'second set item 3'))
$array2 = [ at ]([ at ]('first set item 1', 'first set item 2', 'first set item3'))

What I am creating is an array of arrays....if I pass each of these into a
function:

function ArrayTest
{
param ($items)

foreach ($item in $items)
{
'{0} {1} {2} {3}' -f $item[0], $item[1], $item[2], $item[3]
}
}

when $array2 is passed in, the foreach loop decomposes $items into the four
pieces and the [1], [2] annd [3] items are $null

This seems to be inconsistent handling of arrays and I am wondering what the
logic behind this behavior is

Thanks


Home | Search | Terms | Imprint Contact
Newsgroups Reader - provided by WiredBox.Net
Suche nach Orten, Städten, Postleitzahlen, Vorwahlen, Kfz-Kennzeichen