Hi gurus,
I need to set up an array like this
set - A arr 'A', 'B'
The output of this array should be like this 'A','B'
Right now, I get the output like this 'A B'
Can anyone suggest me on how to achieve this.
thanks (3 Replies)
I'm trying to take the output of an environment that has multiple strings
ex.
# echo $SSH_CLIENT
192.168.1.1 57039 22
I need that IP... so I can set it to another environment.
Thank you (3 Replies)
Hi Guys,
I've been having some arguments with my colleagues about one thing. Always my thought was that as as far as disk performance is concern by looking at the output of the iostat command (AIX) you would be able to identify if you have a hot disk and then by moving some files out that disk... (3 Replies)
Hi all,
I have a script which produces a nice table but I want to sort it on column 3.
This is the output line in the script:
# Output
{ FS = ":";
format = "%11s %6s %-16s\n";
prinft "\n"
printf ( format, "Size","Count","Who" ) }
for (i in... (21 Replies)
Hey, guys, scripting newb here. I'm trying to get a list of all .dmg files in a folder and save the output into an array. My first attempt was
ARRAY= ( `ls $REIMAGEPATH | grep \.dmg$` )
However, I understand why that doesn't work now (at least I think I do).
But I don't know what the... (5 Replies)
Hi,
How to store the values in array from output result,
EG:
I have the result like this,
ps, google, 1.txt, 1
sam, google, 2.txt, 2
These are the four values followed by comma in two sets. I need to store these values set by set. One set contains four values followed by comma.
... (2 Replies)
Hi
I'm trying to write a shell script which finds all the .zip files in a given directory then lists them on the screen and prompts the user to select one by entering a number e.g.
The available files are:
1. HaveANiceDay.zip
2. LinuxHelp.zip
3. Arrays.zip
Please enter the... (4 Replies)
Hello All,
Q1) I have the below code but when the email was sent out all lines are merged and coming out as a single line though my printf statement has newline "\n", How do i avoid that?
Q2) In my second IF statement when i introduced the backslash "\" for continuation of a line or command, i... (10 Replies)
Hello All,
Can you please help me with the below.
#!/bin/bash
ARR="No Differences In Stage Between HASH_TOTALS & HASH_TOTALS_COMP For UNINUM:0722075 PROVIDER:5 EXTRACT_DT:30-SEP-12 VER_NUM:1"
ARR="No Differences In Stage Between HASH_TOTALS & HASH_TOTALS_COMP For UNINUM:0722075 PROVIDER:5... (14 Replies)
Dear Friends,
Please help me on this
my script name is send.csh
In this i have written the statement like this
set args = ( city state country price )
I want to pass this array to another c shell called receiver.csh. and i want to use it in this c shell
or
how to pass to... (2 Replies)
Discussion started by: SA_Palani
2 Replies
LEARN ABOUT PHP
list
LIST(3) 1 LIST(3)list - Assign variables as if they were an arraySYNOPSIS
array list (mixed $var1, [mixed $...])
DESCRIPTION
Like array(3), this is not really a function, but a language construct. list(3) is used to assign a list of variables in one operation.
PARAMETERS
o $var1
- A variable.
RETURN VALUES
Returns the assigned array.
EXAMPLES
Example #1
list(3) examples
<?php
$info = array('coffee', 'brown', 'caffeine');
// Listing all the variables
list($drink, $color, $power) = $info;
echo "$drink is $color and $power makes it special.
";
// Listing some of them
list($drink, , $power) = $info;
echo "$drink has $power.
";
// Or let's skip to only the third one
list( , , $power) = $info;
echo "I need $power!
";
// list() doesn't work with strings
list($bar) = "abcde";
var_dump($bar); // NULL
?>
Example #2
An example use of list(3)
<table>
<tr>
<th>Employee name</th>
<th>Salary</th>
</tr>
<?php
$result = $pdo->query("SELECT id, name, salary FROM employees");
while (list($id, $name, $salary) = $result->fetch(PDO::FETCH_NUM)) {
echo " <tr>
" .
" <td><a href="info.php?id=$id">$name</a></td>
" .
" <td>$salary</td>
" .
" </tr>
";
}
?>
</table>
Example #3
Using nested list(3)
<?php
list($a, list($b, $c)) = array(1, array(2, 3));
var_dump($a, $b, $c);
?>
int(1)int(2)int(3)
Example #4
Using list(3) with array indices
<?php
$info = array('coffee', 'brown', 'caffeine');
list($a[0], $a[1], $a[2]) = $info;
var_dump($a);
?>
Gives the following output (note the order of the elements compared in which order they were written in the list(3) syntax):
array(3) {
[2]=>
string(8) "caffeine"
[1]=>
string(5) "brown"
[0]=>
string(6) "coffee"
}
NOTES
Warning
list(3) assigns the values starting with the right-most parameter. If you are using plain variables, you don't have to worry about
this. But if you are using arrays with indices you usually expect the order of the indices in the array the same you wrote in the
list(3) from left to right; which it isn't. It's assigned in the reverse order.
Warning
Modification of the array during list(3) execution (e.g. using list($a, $b) = $b) results in undefined behavior.
Note
list(3) only works on numerical arrays and assumes the numerical indices start at 0.
SEE ALSO each(3), array(3), extract(3).
PHP Documentation Group LIST(3)