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

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

delphi - blogger via idHTTP : error 400 bad request -

postgresql - ERROR: operator is not unique: unknown + unknown -