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 -

content management system - How to allow only English submissions on Pligg CMS -

c++ - Is it possible to apply breadth-first search algorithm of boost library to matrix? -