News for hackers. Stuff that matters.
Re:I Like PHP by dchest on Wednesday August 10, 2011 @02:41PM (#2869593)
> user comments

Ha-ha-ha. You're kidding, right?

Check strlen: http://www.php.net/manual/en/function.strlen.php

Comments:

1. Comment about how PHP converts types. "Conclusion: The values are converted to string before check the lenght."

2. Comment from a novice user who posted a solution to the problem of subtracting the number of spaces in string from its length.

3. Comment about someone who thought that there was a bug in strlen, but it actually was a documented difference in behavior between two minor versions of PHP.

4. Comment about counting characters in UTF-8 encoded string by decoding it to some other one-byte encoding.

5. Comment about counting characters in UTF-8. Actually, the whole new function.

6. Reminder that \r\n are actually two bytes! "If I had thought of this starting out, I would have saved myself several hours of trouble trying to get php to cut a message to the same length that my auxiliary javascript validation imposed on it."

7. Benchmarks for different UTF-8 strlen implementations.

8. Complaint about another comment, which suggested the function to count characters in UTF-8 strings that didn't work. And the "proper" solution using regular expressions.

...

Re:I Like PHP by exDM69 on Thursday August 11, 2011 @06:30AM (#2872215)
When I wrote some php years ago, the comments were actually useful. They had the most up-to-date information about the latest bugs in the php standard libs.
Re:I Like PHP by 46Bit on Wednesday August 10, 2011 @08:13PM (#2870790)
It may just be a side effect of PHP's problems, but even the wrong comments tend to be extremely useful when you run into something weird when coding. Of course it's always more fun to bash people & programming languages, so maybe I'll just join in: that bloody Ruby API reference lacks any comments from users who might have noticed something that's causing a strange bug in my script.
Re:I Like PHP by dadads on Wednesday August 10, 2011 @10:14PM (#2871051)
As much as I love Ruby, I have to say that the Ruby docs website is shit. No search bar (unlike the PHP docs website).
Re:I Like PHP by DuoSRX on Thursday August 11, 2011 @03:32AM (#2871875)
Agreed. I use http://rdoc.info/stdlib/core/1.9.2/frames which has search and a nice UI.
Re:I Like PHP by henrikschroder on Wednesday August 10, 2011 @08:23PM (#2870816)
Thanks, I haven't laughed this much in a long while.