php - How to use explode to split -


i need split text when users add new line , put new line (by html) array position.

<?php $urlstoafiliate = $_post['urls']; $affcj = "http://www.an.com";  $arraylinks = explode("/\r\n|\n|\r/", $urlstoafiliate); echo $arraylinks[ 0 ];  //echo $nombre; ?> 

you have need preg_split() :

<?php   $urlstoafiliate = $_post['urls'];   $arraylinks = preg_split("/\r\n|\n|\r/", $urlstoafiliate);   print_r($arraylinks);   // or    echo $arraylinks[0];  ?> 

more details : http://php.net/manual/en/function.preg-split.php


Comments

Popular posts from this blog

php - trouble displaying mysqli database results in correct order -

depending on nth recurrence of job in control M -

sql server - Cannot query correctly (MSSQL - PHP - JSON) -