Jump to content

question about counting array elements


itiswutitis

Recommended Posts

When I run the code below, the count function is returning 72. Why is it not returning 64 as I think it should?

 

<?php

 

<$board = array(array('x', 'x', 'x', 'x', 'x', 'x', 'x', 'x'),array('x', 'x', 'x', 'x', 'x', 'x', 'x', 'x'),array('x', 'x', 'x', 'x', 'x', 'x', 'x', 'x'),array('x', 'x', 'x', 'x', 'x', 'x', 'x', 'x'),array('x', 'x', 'x', 'x', 'x', 'x', 'x', 'x'),array('x', 'x', 'x', 'x', 'x', 'x', 'x', 'x'),array('x', 'x', 'x', 'x', 'x', 'x', 'x', 'x'),array('x', 'x', 'x', 'x', 'x', 'x', 'x', 'x'));echo "<pre>";foreach($board as $row){foreach ($row as $piece)echo "$piece ";echo "<br>";}echo "</pre>";echo count($board, 1);

?>

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...