Part of the EllisLab Network
   
 
[OPTIMIZATION] Email library > _str_to_array()
Posted: 06 May 2007 06:42 AM   [ Ignore ]  
Lab Assistant
Avatar
RankRank
Total Posts:  248
Joined  02-10-2007

Here’s the updated function I’ve been working on with Derek Jones. It is three times faster than the original. It is more solid too because strings like ‘email1,,,,email2’ won’t create empty array elements anymore.

For more background information, start reading from here.

function _str_to_array($email) {
    
    
if (is_array($email))
        return
$email;
    
    
$email = trim($email, " \r\n\t,");
    
    return
preg_split('/[\s,]+/', $email);
}

I believe this function can safely be implemented into the core. Derek Allard, could you prepend ‘[COMMITED]’ to the topic title when done so? Thanks a lot.

 Signature 

Kohana rocks!

Profile
 
 
   
 
 
Post Marker Legend
New Topic New posts Hot Topic Hot Topic with new posts New Poll New Poll Moved Topic Moved Topic Sticky Topic Sticky topic
Old Topic No new posts Hot Old Topic Hot Topic with no new posts Old Poll Old Poll Closed Topic Closed Topic Announcement Announcements
Theme
Change Theme
Visitor Statistics
The most visitors ever was 719, on June 06, 2008 10:16 AM
Total Registered Members: 77517 Total Logged-in Users: 21
Total Topics: 101528 Total Anonymous Users: 3
Total Replies: 544284 Total Guests: 242
Total Posts: 645812    
Members ( View Memberlist )