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

asynchronous - C# WinSCP .NET assembly: How to upload multiple files asynchronously -

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -