How to Sort a Multi-dimensional Array by Value

Try a usort. If you are still on PHP 5.2 or earlier, you’ll have to define a sorting function first: function sortByOrder($a, $b) { return $a[‘order’] – $b[‘order’]; } usort($myArray, ‘sortByOrder’); Starting in PHP 5.3, you can use an anonymous function: usort($myArray, function($a, $b) { return $a[‘order’] – $b[‘order’]; }); And finally with PHP 7 … Read more

Merge/flatten an array of arrays

You can use concat to merge arrays: var arrays = [ [“$6”], [“$12”], [“$25”], [“$25”], [“$18”], [“$22”], [“$10”] ]; var merged = [].concat.apply([], arrays); console.log(merged); Using the apply method of concat will just take the second parameter as an array, so the last line is identical to this: var merged2 = [].concat([“$6”], [“$12”], [“$25”], [“$25”], … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)