snike Established Member โ 15 โ Impact 3 Feb 28, 2008 413 views 2 replies #1 Let's say I had an array like this one: fruit[0] = app fruit[1] = bana fruit[2] = lem fruit[3] = oran and i wanted to sort that to look like this: $string = "0=app#1=bana .... etc. How can I do this? Thanks in advance.
Let's say I had an array like this one: fruit[0] = app fruit[1] = bana fruit[2] = lem fruit[3] = oran and i wanted to sort that to look like this: $string = "0=app#1=bana .... etc. How can I do this? Thanks in advance.
monaco Established Member โ 20 โ Impact 10 Feb 28, 2008 #2 See http://us3.php.net/array and http://us3.php.net/manual/en/function.asort.php. The first page explains arrays and lists all the functions, the second demonstrates sorting an array of fruits, of all things.
See http://us3.php.net/array and http://us3.php.net/manual/en/function.asort.php. The first page explains arrays and lists all the functions, the second demonstrates sorting an array of fruits, of all things.
mignolo Established Member โ 15 โ Impact 10 Feb 28, 2008 #3 It's: asort($fruit); then you can make the foreach to create your string...