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 need to sort an associative array by any of the fields in the array, such as author or title or publisher or category. See array below
All I know isCode: Select all
asort($books);Code: Select all
asort($books[author]);Code: Select all
array_push($books,array("category" => "Computer","title" => "PHP Code","author" => "Guelier","publisher" => "Orn","price" => "39.99"));
array_push($books,array("category" => "Business","title" => "Business Leaders","author" => "Oneil","publisher" => "IBD","price" => "9.99"));
array_push($books,array("category" => "Business","title" => "How to Make Money","author" => "Richy","publisher" => "Hall","price" => "49.99"));
array_push($books,array("category" => "Romance","title" => "Something Wicked","author" => "Roberts","publisher" => "Lak","price" => "9.99"));
array_push($books,array("category" => "Romance","title" => "Twice Kissed","author" => "Jackson","publisher" => "McGraw","price" => "24.99"));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]