What is meta? ×
Meta Stack Exchange is where users like you discuss bugs, features, and support issues that affect the software powering all 129 Stack Exchange communities.

I've just seen this question, PHP Hash Removal, where the problem was that str_replace("#", "", $foo) failed; and the correct answer is that it should use single quotes instead of double quotes. OP says it worked.

I'm glad it somehow made the trick for him. However, I'm almost 100% positive that PHP's str_replace function doesn't make any fundamental difference between single quotes and double quotes.

I'm afraid this kind of answer to a question, even though accepted, enforces programming by superstition, especially since no one could reproduce the problem on their computer (both kinds of quotes have the same, correct results for everyone). The guy who answered said he had the problem once and doesn't really recall the circumstances.

My belief is that the guy changed something else and didn't test it, and then when he was prompted to change the single quotes to double quotes, it suddenly worked because of that other change, or something along these lines.

There is also a certain number of other questions with very lowly scores being accepted, which seems as wrong to me.

What should be done about questions with accepted answers that visibly are superstitions? Should Stack Overflow be proud of leaving this kind of answer for posterity?

inb4 "With PHP you never know"

share|improve this question
    
(I'm somewhat certain this question was a case of not assigning the returned value.) –  mario May 8 '11 at 15:46

2 Answers 2

What should be done about questions with accepted answers that visibly are superstitions?

Downvote and leave a comment, as I'm about to do -- that's a very silly answer.

share|improve this answer

I would leave a comment pointing out that the accepted answer is not correct; in that way, who reads the question and the accepted answer will understand that is not the right answer.

There is also a chance that the question is not complete and it doesn't report exactly in which case the issue is noticed. It could also be worth adding a comment to the question asking to the OP to explain how using single quotes helped, and suggesting to rewrite the question to make clearer what the OP was asking.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .