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++ - compiler errors when initializing EXPECT_CALL with function which has program_options::variables_map as parameter -

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