Last active
December 8, 2023 16:40
-
-
Save ziadoz/ab4833697b5b0135a2f1a4ed0becc2e8 to your computer and use it in GitHub Desktop.
PHP - Get Maximum Count of Multi-Dimensional Array
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// @see: https://stackoverflow.com/questions/2189479/get-the-maximum-value-from-an-element-in-a-multidimensional-array | |
$array = [ | |
'foo' => [1, 2, 3], | |
'bar' => [1], | |
'baz' => [1, 2], | |
]; | |
echo count(max($array)); // 3 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment