如何计算PHP中的字符串?

i have this situation"

foreach($front->getRequest()->getParams() as $key => $value){
  if ($value == '1'){
  $$key = $value;  
  }
}
echo $test1; // test1 = 1
echo $test2; // test2 = 1
....

this will give me back one or more $test = 1 where the $$key = $test and $value = 1

i want to see how many actually come back. and i was thinking to do something like: print_r(count($key)) or print_r(count($value)) but it doesn't tell me how many results are there

any ideas?

thanks

Why not just keep a counter?

$count = 0;
foreach($front->getRequest()->getParams() as $key => $value){
    if ($value == '1'){
        $$key = $value;  
        $count++;
    } 
}
echo $count;