note 113868 added to function.count
| From: | GerdChristianKunze | Date: | Wed, 11 Dec 2013 12:56:21 +0000 |
| Subject: | note 113868 added to function.count | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-197905@lists.php.net to get a copy of this message | ||
Get maxWidth and maxHeight of a two dimensional array..?
Note:
1st dimension = Y (height)
2nd dimension = X (width)
e.g. rows and cols in database result arrays
<?php
$TwoDimensionalArray = array( 0 => array( 'key' => 'value', ...), ... );
?>
So for Y (maxHeight)
<?php
$maxHeight = count( $TwoDimensionalArray )
?>
And for X (maxWidth)
<?php
$maxWidth = max( array_map( 'count', $TwoDimensionalArray ) );
?>
Simple? ;-)
----
Server IP: 72.52.91.14
Probable Submitter: 72.52.91.14
----
Manual Page -- http://php.net/manual/en/function.count.php
Edit -- https://master.php.net/note/edit/113868
Del: integrated -- https://master.php.net/note/delete/113868/integrated
Del: useless -- https://master.php.net/note/delete/113868/useless
Del: bad code -- https://master.php.net/note/delete/113868/bad+code
Del: spam -- https://master.php.net/note/delete/113868/spam
Del: non-english -- https://master.php.net/note/delete/113868/non-english
Del: in docs -- https://master.php.net/note/delete/113868/in+docs
Del: other reasons-- https://master.php.net/note/delete/113868
Reject -- https://master.php.net/note/reject/113868
Search -- https://master.php.net/manage/user-notes.php