Part of the EllisLab Network
   
 
[OPTIMIZATION] Email library > _str_to_array()
Posted: 06 May 2007 06:42 AM   [ Ignore ]  
Lab Assistant
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 819, on March 11, 2010 11:15 AM
Total Registered Members: 120211 Total Logged-in Users: 58
Total Topics: 126341 Total Anonymous Users: 2
Total Replies: 664437 Total Guests: 525
Total Posts: 790778    
Members ( View Memberlist )