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

Popular posts from this blog

delphi - blogger via idHTTP : error 400 bad request -

c++ - cuda, pycuda -- how to write complex numbers -- errors:class "cuComplex" has no member "i" -

How do I check if an insert was successful with MySQLdb in Python? -