Hacker News new | comments | show | ask | jobs | submit login

> user comments

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

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


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.


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.

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.

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).

Agreed. I use http://rdoc.info/stdlib/core/1.9.2/frames which has search and a nice UI.

Thanks, I haven't laughed this much in a long while.

Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact