note 90177 deleted from function.count by thiago

From: Date: Thu, 09 Apr 2009 12:16:21 +0000
Subject: note 90177 deleted from function.count by thiago
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-153013@lists.php.net to get a copy of this message
Note Submitter: zgamer99 at hotmail dot com ---- php 5.3 adds support to count a multi-dimensional array without the need for recursion, another option which would be fast is with session variables. While you are building the array original from your database query a looping function builds the dimensions and you will need to obtain the number of rows with something similar to the following: $rowcount = mysqli_num_rows($myquery); On the next line: $_SESSION['rowcount'] = $rowcount; then on the page needing the rowcount information do something like: $rowcount = $_SESSION['rowcount']; unset($_SESSION['rowcount']); Then your $rowcount is easily available and the session memory usage has been released. Granted if you are not performing some kind of loop to build the multi-dimensional array first you will not be able to take advantage of this method. Enjoy.

« previous php.notes (#153013) next »