On 31 August 2010 17:49, Richard Quadling wrote:
> On 31 August 2010 17:39, Richard Quadling wrote:
>> On 31 August 2010 17:06, Tontonq Tontonq wrote:
>>> Array
>>> (
>>> [300] => 300
>>> [301] => 301
>>> ...
If you add a ...
sort($data) ...
just before the foreach() loop...
Array
(
[0]
On 31 August 2010 17:39, Richard Quadling wrote:
> On 31 August 2010 17:06, Tontonq Tontonq wrote:
>> Array
>> (
>> [300] => 300
>> [301] => 301
>> ...
Not sure what happened there!
300,
301 => 301,
302 => 302,
303 => 303,
304 => 304,
305 => 305,
i think its my mistake it will begin from first value of array it will
continue until if its more big than +2 and it
2010/8/31 Ashley Sheridan
> On Tue, 2010-08-31 at 19:06 +0300, Tontonq Tontonq wrote:
>
> Ty four your all replies i got 9 replies less than 10 minutes :)
>
> than can u answer t
On 31 August 2010 17:06, Tontonq Tontonq wrote:
> Array
> (
> [300] => 300
> [301] => 301
> [302] => 302
> [303] => 303
> [304] => 304
> [305] => 305
> [306] => 306
> [307] => 307
> [308] => 308
> [309] => 309
> [310] => 310
> [311] => 311
> [312] => 312
> [313] => 313
> [314] => 314
> [165] => 16
On Tue, 2010-08-31 at 16:58 +0100, Richard Quadling wrote:
> On 31 August 2010 16:45, Ashley Sheridan wrote:
> > There are two ways I see to do it. You can iterate the array and create
> > a copy, assigning elements dynamic values:
> >
> > $new_array = array();
> > foreach($array as $a)
> > {
> >
On Tue, 2010-08-31 at 19:06 +0300, Tontonq Tontonq wrote:
> Ty four your all replies i got 9 replies less than 10 minutes :)
>
> than can u answer this too
> my array is like that for now
> Array
> (
> [300] => 300
> [301] => 301
> [302] => 302
> [303] => 303
> [304] => 304
> [305] => 305
> [306]
Have a look at the manual, especially the function "array_values()".
/frank
Skickat från min iPhone.
31 aug 2010 kl. 17:43 skrev Tontonq Tontonq :
> a quick question
> lets say i have an array like that
>
>
> Array
> (
> [300] => 300
> [301] => 301
> [302] => 302
> [303] => 303
> [304] => 304
On 31 August 2010 16:45, Ashley Sheridan wrote:
> There are two ways I see to do it. You can iterate the array and create
> a copy, assigning elements dynamic values:
>
> $new_array = array();
> foreach($array as $a)
> {
> $new_array[] = $a;
> }
>
> or use a sorting function on it that doesn't
On Tue, 2010-08-31 at 19:06 +0300, Tontonq Tontonq wrote:
> Ty four your all replies i got 9 replies less than 10 minutes :)
>
> than can u answer this too
> my array is like that for now
> Array
> (
> [300] => 300
> [301] => 301
> [302] => 302
> [303] => 303
> [304] => 304
> [305] => 305
> [306]
Ty four your all replies i got 9 replies less than 10 minutes :)
than can u answer this too
my array is like that for now
Array
(
[300] => 300
[301] => 301
[302] => 302
[303] => 303
[304] => 304
[305] => 305
[306] => 306
[307] => 307
[308] => 308
[309] => 309
[310] => 310
[311] => 311
[312] => 312
On 31 August 2010 16:43, Tontonq Tontonq wrote:
> a quick question
> lets say i have an array like that
>
>
> Array
> (
> [300] => 300
> [301] => 301
> [302] => 302
> [303] => 303
> [304] => 304
> [305] => 305
> [306] => 306
> [307] => 307
> [308] => 308
> ...
> how can i change keys to 0,1,2,3,..
On Aug 31, 2010, at 11:46 AM, Ashley Sheridan wrote:
> On Tue, 2010-08-31 at 11:46 -0400, Joshua Kehn wrote:
>>
>> Quickest way I can think of would be to do something like
>>
>> $tmp = array();
>>
>> foreach($old_array as $key => $value)
>> {
>> $tmp[$value] = $key;
>> }
>>
>> But knowin
On Tue, 2010-08-31 at 11:46 -0400, Joshua Kehn wrote:
> Quickest way I can think of would be to do something like
>
> $tmp = array();
>
> foreach($old_array as $key => $value)
> {
> $tmp[$value] = $key;
> }
>
> But knowing PHP there is probably some array_reverse_keys() function.
>
> Reg
The fastest way is going to be array_values():
http://www.php.net/array_values
--Larry Garfield
On 8/31/10 10:43 AM, Tontonq Tontonq wrote:
a quick question
lets say i have an array like that
Array
(
[300] => 300
[301] => 301
[302] => 302
[303] => 303
[304] => 304
[305] => 305
[306] =>
On Tue, 2010-08-31 at 18:43 +0300, Tontonq Tontonq wrote:
> a quick question
> lets say i have an array like that
>
>
> Array
> (
> [300] => 300
> [301] => 301
> [302] => 302
> [303] => 303
> [304] => 304
> [305] => 305
> [306] => 306
> [307] => 307
> [308] => 308
> ...
> how can i change keys t
Quickest way I can think of would be to do something like
$tmp = array();
foreach($old_array as $key => $value)
{
$tmp[$value] = $key;
}
But knowing PHP there is probably some array_reverse_keys() function.
Regards,
-Josh
Joshua Kehn | josh.k...@gma
16 matches
Mail list logo