Obtain first line of a string in PHP -
Obtain first line of a string in PHP -
in php 5.3 there nice function seems want:
strstr(input,"\n",true)
unfortunately, server runs php 5.2.17 , optional 3rd parameter of strstr
not available. there way accomplish in previous versions in 1 line?
here go
$str = strtok($input, "\n");
php string newline strstr
Comments
Post a Comment