Skip to content

Instantly share code, notes, and snippets.

@ziadoz
Last active March 22, 2024 16:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ziadoz/9c15e77c5bbab95d31dd1d44ea842351 to your computer and use it in GitHub Desktop.
Save ziadoz/9c15e77c5bbab95d31dd1d44ea842351 to your computer and use it in GitHub Desktop.
PHP - Find Min/Max Count in Multi-Dimensional Array
<?php
// @see: https://stackoverflow.com/questions/21861825/quick-way-to-find-the-largest-array-in-a-multidimensional-array
$array = [
['foo', 'bar'],
['foo'],
['foo', 'bar', 'baz'],
];
echo count(max($array)) . PHP_EOL;
echo count(min($array)) . PHP_EOL;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment