- preg_match: documentation ( source)
<?php
$array = array(
'123',
'13',
'1 3',
'31',
'21',
'321',
'23',
'2',
'3',
'',
' 12',
);
$counter = 0;
foreach ( $array as $tunnus )
{
$counter += (int) preg_match( '#1#', $tunnus );
}
echo $counter;