note 90392 added to function.count
| From: | jezdec at email dot cz | Date: | Sun, 19 Apr 2009 23:42:37 +0000 |
| Subject: | note 90392 added to function.count | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-153503@lists.php.net to get a copy of this message | ||
Hi there,
there is a simple script with example for counting rows and columns of a two-dimensional array.
<?php
$data = array(
"apples" =>
array("red", "yellow", "pineapples"),
"bananas" =>
array("small", "medium", "big"),
"vegs" =>
array("potatoes", "carrots", "onions")
);
$rows = count($data,0);
$cols = (count($data,1)/count($data,0))-1;
print "There are {$rows} rows and {$cols} columns in the table!";
?>
----
Server IP: 212.24.129.51
Probable Submitter: 94.112.2.81
----
Manual Page -- http://www.php.net/manual/en/function.count.php
Edit -- https://master.php.net/note/edit/90392
Del: integrated -- https://master.php.net/note/delete/90392/integrated
Del: useless -- https://master.php.net/note/delete/90392/useless
Del: bad code -- https://master.php.net/note/delete/90392/bad+code
Del: spam -- https://master.php.net/note/delete/90392/spam
Del: non-english -- https://master.php.net/note/delete/90392/non-english
Del: in docs -- https://master.php.net/note/delete/90392/in+docs
Del: other reasons-- https://master.php.net/note/delete/90392
Reject -- https://master.php.net/note/reject/90392
Search -- https://master.php.net/manage/user-notes.php