If Array Keys Are Same . then Values added one by one based on comma .
How .. Each and Every time Array keys are Generated Dynamically .. Help Me .. Thanks .See the Below Image I am Getting Array Leke This . Based On that Array I want Out PUT Like This ...
NOTE : Keys Are Not static ... It generated Dynamically
array([10]=>12,7
[4]=>7)
If you assign key/value pairs to an array, the comma is used to separate the pairs. The keynames must be strings. If you need numeric values with decimals, use a dot, not a comma.
E.g.:
$myArray = array(
'10'=>12.7,
'4'=>7
);
Will result in :
$myArray[10] => 12.7
$myArray[4] => 7
Thanks For U r Answer ..
But each every time Arrays changed .. Some times I am Getting Only One Array . Some Times Two , Some Times Four .. These arrays Dynamically generated .. On that Time...?
It still isn't very clear what you try to do and what you want to achieve. Please, share some code with us.
Generally speaking, an array can't contain multiple keys with the same name.
If you created an array like this (no matter if it is done dynamically or by hard coding):
(02-09-2016, 11:16 PM)Wouter60 Wrote: It still isn't very clear what you try to do and what you want to achieve. Please, share some code with us.
Generally speaking, an array can't contain multiple keys with the same name.
If you created an array like this (no matter if it is done dynamically or by hard coding):
PHP Code:
$myArray = array( 10 => 12, 4 => 7 );
And you assign a value like:
PHP Code:
$myArray[10] = 7;
The value of key 10 simply changes from 12 to 7.
array([10]=>12,[4]=>7);
array([5]=>1,[10]=>9);
array([6]=>2,[4]=>15);
Thing is Very Clear .. In Above I am Getting 3 different arrays. In that arrays I am Getting Same Keys ... Now In this Condition I want To output Like This :
BAsed On above 3 arrays ...
array([10]=>12_9,[4]=>7_15,[5]=>1,[6]=>2);
Like This ..
Thanks For U r support ..
(02-09-2016, 09:53 PM)Chandini Wrote: But each every time Arrays changed .. Some times I am Getting Only One Array . Some Times Two , Some Times Four .. These arrays Dynamically generated .. On that Time...?
So you don't the number of arrays in advance? How do you get them and how do you store them?