• 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

401 Unauthorized only occurring on some pages in Laravel 8

Laravel Pagination links() not working

Check If array is null or not in php

Component install error: JInstaller: :Install: File does not exist

Search for array row with specific column value and return another value from qualifying row

Remove country code from phone number?

Composer Curl error 60: SSL certificate problem: unable to get local issuer certificate

Why the name of trucks are same in 2nd and 3rd record of company data retrieval?

Laravel: HTML in notification

(PHPUnit) PHP Fatal error: Uncaught Error: Call to undefined function each()

PHP code for generating decent-looking coupon codes (mix of letters and numbers)

Upload a file Using PHP and JavaScript

PHP error: "The zip extension and unzip command are both missing, skipping."

PHP - CURL using HTTPS [closed]

Symfony there are no commands defined in the "make" namespace

About Contact Privacy policy Terms and conditions