ali_2kool2002 Posted February 19, 2007 Share Posted February 19, 2007 ie can anyone tel me if there is a function i could use or something to find the current size of this array? $_POST['txtbox'] i want to know the current size, which im not sure what it is :-\ :-\ Link to comment https://forums.phpfreaks.com/topic/39190-solved-how-to-calculate-the-current-size-of-an-array-post/ Share on other sites More sharing options...
boo_lolly Posted February 19, 2007 Share Posted February 19, 2007 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. Link to comment https://forums.phpfreaks.com/topic/39190-solved-how-to-calculate-the-current-size-of-an-array-post/#findComment-188733 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.