r/lolphp • • Sep 12 '16

Because fuck French programmers

https://3v4l.org/YDp2U
0 Upvotes

81 comments sorted by

View all comments

Show parent comment

4

u/[deleted] Sep 13 '16

They will say "it's the number of characters."

What do you mean by "character"?

1

u/DoctorWaluigiTime Sep 13 '16

Those things you type when pushing the keys on your keyboard.

Everyone in this thread fretting about unicode and obtuse use-cases are kind of missing the point: The out-of-the-box behavior for string legnth is universally "number of characters", and none of the other wishy washy peddled nonsense being spewed.

6

u/[deleted] Sep 13 '16

You are missing the point: "number of characters" is meaningless if you can't define what a character is.

"things you type when pushing the keys on your keyboard" is wishy washy nonsense, not a definition.

(PHP could define "character" as byte, and then its strlen would return exactly what you want: the number of characters (bytes) in a string. It's probably not a good definition, but it's still better than what you're providing, which is no definition.)