Say i have a function
function test($a, $b)
{
...
}
And i have
$x = "a b"
I cant pass it
> test $x
but i can pass it
> test a b
Is there a way to pass multiple params through the one variable?
ie
$x = "a b"
test $x
Say i have a function
function test($a, $b)
{
...
}
And i have
$x = "a b"
I cant pass it
> test $x
but i can pass it
> test a b
Is there a way to pass multiple params through the one variable?
ie
$x = "a b"
test $x
Yes, but not as a single string like that. Instead, you would have an array or a hashtable for your variable, and you would use a technique called Splatting. That looks like this:
$array = 'a', 'b' test @array
You can get all the gritty details in the about_Splatting help file.
https://technet.microsoft.com/en-us/library/jj672955.aspx