8 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Required Unix shell script which will identify the difference of String2 based on string1. I am facing this issue and unable to achieve the result.
String1= {1 3 lok kam}
String2= {3 kam 5}
Result should be like below:
Data is matching for: 3
Data is matching for: kam
Data is not matching... (7 Replies)
Discussion started by: lokendrasb
7 Replies
2. Shell Programming and Scripting
Hi,
Can anybody help me in finding the difference between two array elements with the help of code pls.
purge=("Purge Concurrent Request and/or Manager Data" "Purge Signon Audit data" "Purge Obsolete Workflow Runtime Data" "Purge Logs and Closed System Alerts")
purge_1=("Purge Obsolete... (3 Replies)
Discussion started by: Y.balakrishna
3 Replies
3. Solaris
Hi,
I am on Sun Edge 6120 Disk array. When I do port listmap.
The failover status below means I have to take action. I never used Sun Array before. Please advice.
port targetid addr_type lun volume owner access
u1p1 1 hard 0 v0 ... (0 Replies)
Discussion started by: samnyc
0 Replies
4. UNIX for Dummies Questions & Answers
Hi,
I need to find the difference between 2 dates in SunOS 5.10
input will be in(yyyymmdd)
date1: 20131011
date2:20131012
my output shold be diff between two dates i.e 0,1,2,3 date2 is always greater than date1.
if it handles even leap year then it wil be more helpful.
thank u... (2 Replies)
Discussion started by: mohanalakshmi
2 Replies
5. Shell Programming and Scripting
Hi ,
I want to find out the time difference. If the system date and time is "Jul 18 05:39:00" EST then it should return "Jul 18 04:39:00". i.e one hour differnce in time. Pls help me out.
Other eg's : Jul 18 00:00:00 -> Jul 18 23:00:00
Jul 18 01:00:00 -> Jul 17 00:00:00 (3 Replies)
Discussion started by: arukuku
3 Replies
6. Shell Programming and Scripting
Hello
Thanks everyone for the help earlier, what I would like to learn now is how can I achieve the following :
array1 = (1234567,7665456,998889,000909)
array2 = (1234567,5581445,998889,000909)
Result
5581445 doesn't exist on array1
Thank you (6 Replies)
Discussion started by: amlife
6 Replies
7. Solaris
Hi All,
Can you please help to understand the major differences between Sun cluster 3.1 and 3.2.
Thanks,
Deepak (1 Reply)
Discussion started by: naw_deepak
1 Replies
8. UNIX for Dummies Questions & Answers
Hi All,
Iam curious to know wat are the differences between a sun machine and a linux machine?( In terms of architecture,applications etc)
Thanks in advance (3 Replies)
Discussion started by: raz
3 Replies
ARRAY(3) 1 ARRAY(3)
array - Create an array
SYNOPSIS
array array ([mixed $...])
DESCRIPTION
Creates an array. Read the section on the array type for more information on what an array is.
PARAMETERS
o $...
- Syntax "index => values", separated by commas, define index and values. index may be of type string or integer. When index is
omitted, an integer index is automatically generated, starting at 0. If index is an integer, next generated index will be the big-
gest integer index + 1. Note that when two identical index are defined, the last overwrite the first. Having a trailing comma
after the last defined array entry, while unusual, is a valid syntax.
RETURN VALUES
Returns an array of the parameters. The parameters can be given an index with the => operator. Read the section on the array type for more
information on what an array is.
EXAMPLES
The following example demonstrates how to create a two-dimensional array, how to specify keys for associative arrays, and how to skip-and-
continue numeric indices in normal arrays.
Example #1
array(3) example
<?php
$fruits = array (
"fruits" => array("a" => "orange", "b" => "banana", "c" => "apple"),
"numbers" => array(1, 2, 3, 4, 5, 6),
"holes" => array("first", 5 => "second", "third")
);
?>
Example #2
Automatic index with array(3)
<?php
$array = array(1, 1, 1, 1, 1, 8 => 1, 4 => 1, 19, 3 => 13);
print_r($array);
?>
The above example will output:
Array
(
[0] => 1
[1] => 1
[2] => 1
[3] => 13
[4] => 1
[8] => 1
[9] => 19
)
Note that index '3' is defined twice, and keep its final value of 13. Index 4 is defined after index 8, and next generated index (value
19) is 9, since biggest index was 8.
This example creates a 1-based array.
Example #3
1-based index with array(3)
<?php
$firstquarter = array(1 => 'January', 'February', 'March');
print_r($firstquarter);
?>
The above example will output:
Array
(
[1] => January
[2] => February
[3] => March
)
As in Perl, you can access a value from the array inside double quotes. However, with PHP you'll need to enclose your array between curly
braces.
Example #4
Accessing an array inside double quotes
<?php
$foo = array('bar' => 'baz');
echo "Hello {$foo['bar']}!"; // Hello baz!
?>
NOTES
Note
array(3) is a language construct used to represent literal arrays, and not a regular function.
SEE ALSO
array_pad(3), list(3), count(3), range(3), foreach, The array type.
PHP Documentation Group ARRAY(3)