I have this code for an array, and the problem is that it shows only two last items of the array.
$svi= array(
$WMN1,
$LNG1,
$SSWN1,
$DT1,
$OET1,
$OW1,
$NT1
);
$imena_sajtova = array(
'Prvi WMN',
'Drugi LNG',
'Treci SSWN',
'Cetvrti DT',
'Peti OET',
'Sesti OW',
'Sedmi NT'
);
$novi_svi =array_combine($svi, $imena_sajtova);
echo '<pre>'; print_r($novi_svi); echo '</pre>';
And the result of this code is:
Array
(
[2] => Sedmi NT
[1] => Sesti OW
)
What could be a problem? Thanks!
var_dump($svi) displays this:
array(7) { [0]=> int(2) [1]=> int(1) [2]=> int(1) [3]=> int(1) [4]=> int(2) [5]=> int(1) [6]=> int(2) }
This $svi array has results from some functions:
$WMN1=RSS_Brojac($WMN);
$LNG1=RSS_Brojac($LNG);
$SSWN1=RSS_Brojac($SSWN);
$DT1=RSS_Brojac($DT);
$OET1=RSS_Brojac($OET);
$OW1=RSS_Brojac($OW);
$NT1=RSS_Brojac($NT);
I've changed order of arrays in the array_combine, and it works!
$novi_svi =array_combine($imena_sajtova, $svi);
arsort($novi_svi);
echo '<pre>'; print_r($novi_svi); echo '</pre>';
And the output of this code is:
Array
(
[Prvi WMN] => 2
[Sedmi NT] => 2
[Peti OET] => 2
[Sesti OW] => 1
[Cetvrti DT] => 1
[Drugi LNG] => 1
[Treci SSWN] => 1
)
I'have sorted them from high to low, that's what I actually wanted to do with this array. Now, how to separate the results, to have them in separate divs inside html? So then, I'll be able to change their style and create some kind of table with these results.
The results are output from some RSS feeds, which I use to count number of published news.
Thank you for your time!