• Categories
    • PHP
    • phpMyAdmin
    • PHPMailer
    • FFMpeg
    • PHPEXcel
    • PHPDoc
    • PHPUnit
    • CakePHP
    • CakePHP 2.0
    • Cake PHP 2.1
    • CakePHP Model
    • Facebook PHP SDK
    • composer-php
    • PHP 7
    • PHP GD
    All Categories
  • About

Sort multidimensional array by column value within a column

phparrayssortingmultidimensional-arraycolumnsorting


PHP Snippet 1:

array_multisort(array_column($array, 'earnest_money_due'), $array);

PHP Snippet 2:

array_multisort(array_map(fn($row) => $row['earnest_money_due']['value'], $array), $array);

PHP Snippet 3:

usort($array, fn($a, $b) => $a['earnest_money_due']['value'] <=> $b['earnest_money_due']['value']);

Related Snippets

Multiply each value in array using array_map function

How to send upload image through email

MySQL upgrade causing unexpected results on simple WHERE clauses

how to see if database exists with PDO [duplicate]

Display the default discounted price and percentage on Woocommerce products

PHP Deprecated issue when running artisan command

Yii Ajax Submit button

How to get median and quartiles/percentiles of an array in JavaScript (or PHP)?

Get keys from associative array [duplicate]

PHP only Hit Counter?

Generate random username based on full name php

Remove country code from phone number?

Why do I have invalid argument supply for foreach in Laravel for json response? [duplicate]

Laravel with App Engine Standard Class 'FacadeIgnitionIgnitionServiceProvider' not found

Comma separated list from array with "and" before last element

About Contact Privacy policy Terms and conditions