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

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -