thiggins09 Posted May 10, 2007 Share Posted May 10, 2007 Hi, how do you get the size of a column in a 2d array. Link to comment https://forums.phpfreaks.com/topic/50843-size-of-2d-array/ Share on other sites More sharing options...
flash gordon Posted May 10, 2007 Share Posted May 10, 2007 count(arr[3]); maybe..... Link to comment https://forums.phpfreaks.com/topic/50843-size-of-2d-array/#findComment-250068 Share on other sites More sharing options...
sasa Posted May 10, 2007 Share Posted May 10, 2007 try <?php function size_of_arr($a){ $b = 0; if (is_array($a)) { foreach ($a as $c) $b += size_of_arr($c); return $b; } return 1; } $a = array(1,array(2,3),4,array(5,array(6,7,,9),10); echo '<pre>'; print_r($a); echo "</pre><hr />\n"; echo 'Size is: ', size_of_arr($a); ?> Link to comment https://forums.phpfreaks.com/topic/50843-size-of-2d-array/#findComment-250102 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.