@domain.com","asd2@domain.com","3@domain.com","4@blah.com","5@blah.com","6@whatever.com");
$domain_count = array();
// Loop through the email addres list counting the number of times each domain is found
foreach( $email_addresses as $key => $value )
{
foreach( $email_addresses as $key => $value )
{
A friend wanted some simple code to count the number of times each email address in a list used the same domain.
// Our list of email addresses
$email_addresses = array("1
// Find where the @ symbol is
$start = strpos($value, "@");
// Get the domain
$domain = substr($value, $start + 1, strlen($value));
$start = strpos($value, "@");
// Get the domain
$domain = substr($value, $start + 1, strlen($value));
// Add to the count
$domain_count[$domain] ++;
}
$domain_count[$domain] ++;
}
// Display the domain list with the count
foreach($domain_count as $key => $value )
{
echo "$key was accessed $value times";
}
foreach($domain_count as $key => $value )
{
echo "$key was accessed $value times";
}
?>
Tidak ada komentar:
Posting Komentar