php - How can I split list of website -
i have list of site :
$list_website = "http://www.stackoverflow.com;http://www.yahoo.com http://www.facebook.com http://www.youtube.com www.google.com";
i want this
array("http://www.stackoverflow.com", "http://www.yahoo.com", "http://www.facebook.com", "http://www.youtube.com", "www.google.com");
i tired :
$txt1 = explode(';\n ',$list_website);
but doesn't wotk.
thanks advance !
you can use preg_split
$list_website = preg_split("/[\n ;]+/", trim($list_website));
Comments
Post a Comment