In PHP 5.3 there is a nice function that seems to do what I want: Unfortunately, the server runs PHP 5.2.17 and the optional third parameter of strstr is not available. Is there a way to achieve this in previous versions in one line? Answer For the relatively short texts, where lines could be delimited by either one (“n”) or
Tag: newline
PHP newline not working in text file
I am using the PHP code: to write $number to a file. For some reason n appears in the file. I am on a mac. What might be the problem? Answer Try this
PHP Linefeeds (n) Not Working
For some reason I can’t use n to create a linefeed when outputting to a file with PHP. It just writes “n” to the file. I’ve tried using “\n” as well, where it just writes “n” (as expected). But I can’t for the life of me figure out why adding n to my strings isn’t creating new lines. I’ve also
How can I alternate between mysqli_real_escape_string and nl?
I’ve been doing some reading on mysqli_real_escape_string(), and, after getting my content properly escaped, I’m having some trouble getting to display properly when I pull it out again. Here’s the …