PHP Script to scan a text and extract all email ids contained in the text. It outputs email addresses as comma separated list.
<?php
/*
Name : PHP extract multiple emails from text
Function expects one parameter which is the text from which email addresses are to be extracted.
It outputs email ids as comma separated list.
*/
function extractMultipleEmailsFromText($text){
// Define the regular expression from extracting email addresses
$regexp = '/([a-z0-9_\.\-])+\@(([a-z0-9\-])+\.)+([a-z0-9]{2,4})+/i';
// Now use it to actually extract email addresses to array
preg_match_all($regexp, $text, $m);
// Now convert it into comma separated list of email addresses
$email_addresses=implode( ", ",$m[0]);
// Now return the list of extracted email addresses
return $email_addresses;
} // End of Exctract Multiple Emails From Text function
// Let us write some dummy text to test it
$test_string = 'Let us put some text here
test1@mysite.com
and some other text
what1@where.com
and then test8@nothing.org
';
//Lets have fun and echo the result to see if it works!
echo extractMultipleEmailsFromText($test_string);
?>
Extract all email addresses from all .txt files in a folder.
Price $10 Order Now
PHP script to extract email addresses from a web page by providing its URL.
Price $5 Order Now
PHP script to extract multiple URLs from a text.
Price $5 Order Now
I want a PHP snippet to extract all Values from a select list along with their texts and return it as an array.
Price $5 Order Now
I want PHP snippet to extract Texts in all anchor tags on a web page. Basically whole linked text.
Price $5 Order Now
PHP Script to Generate Random Password. You can set the list of characters that you want to be used in...
It is a very nice PHP time ago function. You gave pass any date to it and it will tell...
This PHP function extracts all numbers from a String and prints them as a comma separated list of numbers. Ready...
A very simple php snippet to check if an email id is valid or not. If the email address is...
PHP Script to create URL from string. It retails only URL Safe characters in the strings. So, now easily create...
PHP Script to scan a text and extract all email ids contained in the text. It outputs email addresses as...
This is a simple function written in PHP to generate keywords from any text. Just pass any free text to...
This is a simple PHP function to parse text provided and automatically hyperlink the links in the text.