In the below code, data is copied from one array variable to another array variable. is it possible to copy a data from a variable (which is not an array) to a variable which is an array?
i have to store a data more than 100000.
i don't know the size of the data whether it may be 100000 or 1000000.
so how can i define variable size;
example
char abc;
but i don't know the size so how can i give array size??
in one sentence
how can i give the array size dynamically so that i... (6 Replies)
Hello all,
I need to do scripts total up the size in selected extension file for example motion.mov and segmentation.avi is in Label Media. For file info.doc and calc.xls in Label Document.
I need output will be like this:
count 1
Media,,2 GB
count 2
Document,,4 GB
My problem is,... (16 Replies)
Hi,
I am having two set of files with different number of columns and rows.
A set of files have only single row with 20 columns.
B set of files have 1000s of rows with 5 columns.
both set contains equal number of files.
I want to save all the 20 columns of A in variables one by one and... (21 Replies)
hi
My script as below
#!/bin/ksh
for i in `seq 1 7`
do
a=$(awk '{print $i}' /home/rama/expenese.txt)
done
for i in `seq 1 7`
do
echo "${a}"
done
content of expense.txt is as below
5032 210179 3110 132813874 53488966 11459221 5300794
I want output as... (6 Replies)
Hi there,
im a beginner to the shell scripting.i trying to extract a table from a db(IMD) and i have to get the count of that table and size of the file.
can you help me out how to write the shall scriping for the above query. (2 Replies)
This is the sample json I have pasted here. I want all the IP address strings to be converted into an array. For example "10.38.32.202" has to be converted to everywhere in the JSON. There are multiple IPs in a JSON I am pasting one sample object from the JSON. But the IPs already in an Array... (11 Replies)
Discussion started by: vinshas1
11 Replies
LEARN ABOUT PHP
array
ARRAY(3) 1 ARRAY(3)array - Create an arraySYNOPSIS
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)