How can I change the Array key ?
Posted: Wed Aug 16, 2006 12:09 pm
feyd | Please use
now I want to change the position of each array element.
I want to sort the array randomally
so the element key maybe:
or
or anything else
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
I have an array :Code: Select all
$a[] = 'aaaa';
$a[] = 'bbbb';
$a[] = 'ccccc';
$a[] = 'dddd';
$a[] = 'eeee';I want to sort the array randomally
so the element key maybe:
Code: Select all
$a[3] = 'aaaa';
$a[1] = 'bbbb';
$a[5] = 'ccccc';
$a[2] = 'dddd';
$a[4] = 'eeee';Code: Select all
$a[5] = 'aaaa';
$a[1] = 'bbbb';
$a[2] = 'ccccc';
$a[4] = 'dddd';
$a[3] = 'eeee';feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]