Page 1 of 1

Facing problem with count

Posted: Sat Oct 10, 2009 10:36 pm
by soul_fly
Hello there.

The problem:
$matches got 10 results. After I do print_r($mathces); I get this: Array ( [0] => Array ( [0] => hello [1] => hi [2] => devnet [3] => soul [4] => fly ........

Target: I was also trying to echo total number of results, like " You have 10 results in matches"

I tried echo "You Have ".count($matches)."results..";

Actually I'm facing problem with the count of results i have from output. Thanks for your co-operation in advance.

:)

Re: Facing problem with count

Posted: Sat Oct 10, 2009 10:53 pm
by John Cartwright
You were not clear what the issue is.

Are you saying you want to count the first element's array, instead of the original array?

i.e.

Code: Select all

echo "You have ". count($matches[0]) ." results";

Re: Facing problem with count

Posted: Sat Oct 10, 2009 11:03 pm
by soul_fly
John Cartwright wrote:You were not clear what the issue is.

Are you saying you want to count the first element's array, instead of the original array?

i.e.

Code: Select all

echo "You have ". count($matches[0]) ." results";
Yes exactly. Thank you very much. :)