Linked Questions

76 votes
2 answers
94k views

Possible Duplicate: How can I sort arrays and data in PHP? How do I sort a multidimensional array in php PHP Sort Array By SubArray Value PHP sort multidimensional array by value My array ...
user6's user avatar
  • 2,053
0 votes
3 answers
2k views

I have array like this Array ( [0] => Array ( [id] => 16059 [product_id] => 4013 [Product] => Array ( [...
Yogesh Saroya's user avatar
1 vote
5 answers
143 views

I have an array with some values which is being declared on the fly: // a for loop that finds elements from source $array[] = array($fruit, $color, $shape, $price); later i have another for loop ...
Namit's user avatar
  • 1,322
1 vote
2 answers
66 views

Trying to sort an array by name so I can display an alphabetical list. Here's a snippet of code: sort($stores); for ($i = 0; $i < count($stores); $i++) { echo $stores[$i]['name']; } I have a ...
Scully's user avatar
  • 1,058
-2 votes
2 answers
113 views

I have an associative array in PHP like: $newarray1 = Array ( [productA] => Array ( [link] => http://sanjosespartan.com/blog/products/agile-java-development/ [...
pronessssssssssss's user avatar
-1 votes
1 answer
48 views

Array ( [0] => Array ( [userId] => 907 [process] => expert [date] => 2019-10-01 17:55:09 ) [1] => Array ( ...
Onur Çiçek's user avatar
5136 votes
25 answers
852k views

What is this? This is a collection of questions that come up now and then about syntax in PHP. This is also a Community Wiki, so everyone is invited to participate in maintaining this list. This ...
2 votes
3 answers
6k views

I am trying to build a function that displays the reviews from an external json feed in a loop with php. Everything works fine, except the sorting. I would like to sort the items based on the date. &...
Justus's user avatar
  • 123
0 votes
3 answers
1k views

I need to sort my array by value in subarray. I have to do it in two options - desc sort and asc sort (so I need to define this param in function). Here is my array: array(5) { [0]=> array(2) ...
Pavel K's user avatar
  • 235
0 votes
2 answers
1k views

How do I sort a multidimensional array by one of the fields of the inner array? In Java, How I can create a multidimensional array like this? and how I can sort it by X field? Any examples? Array ( ...
ephramd's user avatar
  • 380
6 votes
5 answers
172 views

I need to sort the notification array by the value 'start_date' DESC order from the getNotifications function: $posts_id_arr = getPoststIds($conn); foreach ($posts_id_arr as $key => $val) { $...
Gilad Adar's user avatar
-1 votes
2 answers
539 views

I have an array containing more arrays of state information. One of the key val pairs is the name of the state, which I would like to sort such that the outter array of states contains all of the ...
Hippocrates's user avatar
  • 2,540
1 vote
2 answers
613 views

I have a foreach loop which finds comment replies and stores them in $child_comments After <?php echo '<pre>'; print_r($child_comments); echo '</pre>'; ?> I get a separate array ...
psot's user avatar
  • 194
2 votes
1 answer
839 views

I have to use a webservice which return JSON. After decode JSON I get array: $arrays[0]["2013-04-09"]=$someValue; $arrays[1]["2013-04-09"]=$someValue; $arrays[2]["2013-04-11"]=$someValue; $arrays[3]["...
Bartosz Kowalczyk's user avatar

15 30 50 per page