im sure im not the only one to get annoyed by this, but why is it that people who lack skill and understanding of PHP insist on a single, annoying, ignorant mistake. yes, it works, but it is wrong. what, you might ask, am i talking about? i will get to that, but first...
i want to make it very clear that making the following mistake is a distinct sign of being incapable as a programmer. why? because you are bad at an easy language. have a hard time with pesky type checking? dont like complicated syntax? no problem. PHP (because of its perl roots) is a sincerely simple language. and you cant even use THAT!?
the mistake, my friends, can be found in the following code:
$result = nl2br("$source");
so, why do people insist on putting their string parameter in double quotes. what does this do? well, first the double quotes tell the parser to start interpretting special tokens. then we tell it the name of the string. then it replaces the token with the string. wait, wait, wait! we did what now? you mean, we HAD a string already, and we went through all that extra work?
how about, instead, we stop being retarded and start doing what we mean:
$result = nl2br($source); // same result, less work
now, i know what youre thinking. "why should this bother you? its harmless." no, what it does is it belies the way the programmers mind works (or doesnt). someone, along the line, taught the lesson that if $result is "Yes", something like "Result: $result" will produce "Result: Yes". so, the inept programmer thinks "well, i dont want the 'Result:' part, so i must need to do "$result"".
this shows the programmer never actually LEARNED anything. they just took bits and pieces of code and figured that if the result is what we expect, then everything must be correct. but you couldnt be more wrong. just because the end is correct doesnt mean that the path to get there was acceptable.
a little protip, offered from me, to the lot of you, free of charge, is this: know what your code does. dont just regurgitate useless code written by useless people, and eventually picked up by useless script kiddies. KNOW (truly know) what your code does.
</rant>