note 90392 deleted from function.count by cmb

From: Date: Tue, 04 Oct 2016 18:04:26 +0000
Subject: note 90392 deleted from function.count by cmb
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-206764@lists.php.net to get a copy of this message
Note Submitter: jezdec at email dot cz ---- 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!"; ?>

« previous php.notes (#206764) next »