Jump to content

[SOLVED] how to calculate the current size of an array post?


ali_2kool2002

Recommended Posts

do you mean size as in bytes, or size as in number of array indices with values? if you want number of indices:

<?php
        if(isset($_POST)){
                echo "Number of Indices: ". count($_POST) ."<br />\n";
        }
?>

 

or try:

<?php
        if(isset($_POST)){
                $i = 0;
                foreach($_POST as $key => $val){
                        if ($val != "") { $i++; }
                }
        echo "Number of Indices: ". $i ."<br />\n";
?>

 

try them both and see if your results differ for each piece of code.

get more info from the count() manual page.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.