• 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

Minimum order amount except for specific shipping method in WooCommerce

PHP how to detect if running on arm64 cpu?

PHP: PDO + CSV export not downloading (headers issue?)

How to average columns of data from multiple, flat arrays?

How to get rid of ampersand using WP Nonce URL and WP Redirect or PHP header

Laravel eloquent update record without loading from database

How to submit the custom form data in database in WordPress without plugin using ajax?

Why getting "Build step 'Execute shell' marked build as failure" error while creating a backup tar for files

How to convert the int value to inch in PHP [closed]

"cannot list resources" error from WooCommerce REST API

How to get the total hour from starting time to end time in php

Reorder attribute dropdown terms in Woocommerce single variable products

MOODLE: What does it mean to aggregate h5p assets?

Xdebug can't connect back to Docker host

auth pages not getting css in laravel

About Contact Privacy policy Terms and conditions