thiggins09 Posted May 10, 2007 Share Posted May 10, 2007 Hi, how do you get the size of a column in a 2d array. Quote 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..... Quote 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); ?> Quote Link to comment https://forums.phpfreaks.com/topic/50843-size-of-2d-array/#findComment-250102 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.