Hello,
Knowing the index position of an array, how can i get the next $key
available, if it exists. I've found a solution but I was wondering if
there was a shorcut in PHP.
i.e:
$cats = array (
456=>'myown',
186=>'getto',
714=>'many',
484=>'wondering ',
775=>'ok'
);
In this example, I know that the index postion is 2. So the return
$key should be the next one available, if it exists... that is: 484.
This is how i coded:
$index = 2;
$id = array_slice($ca ts, $index, 1, true);
foreach($id as $key=>$value) {
echo $key;
}
I've look at all the functions on the php web site and couldn't find a
shortcut to this.
Any ideas?
Thanks in advance
Marco
Knowing the index position of an array, how can i get the next $key
available, if it exists. I've found a solution but I was wondering if
there was a shorcut in PHP.
i.e:
$cats = array (
456=>'myown',
186=>'getto',
714=>'many',
484=>'wondering ',
775=>'ok'
);
In this example, I know that the index postion is 2. So the return
$key should be the next one available, if it exists... that is: 484.
This is how i coded:
$index = 2;
$id = array_slice($ca ts, $index, 1, true);
foreach($id as $key=>$value) {
echo $key;
}
I've look at all the functions on the php web site and couldn't find a
shortcut to this.
Any ideas?
Thanks in advance
Marco
Comment