i am wondering when i check the length of the string with strlen function in php
it says its 32. however when i open that in a notepad or notepad++ i can see some empty spaces in the file (incorrect alignment with the other lines,
since i am doing a banking application strlen is critical to be 100% correct.
i am just wondering should i keep trusting this output or should i moved to something else like
mb_strlen
what is the best function to be trusted in normal ASCII character set ?
If you want to use
strlen()ormb_strlen()depends on your servers setup, if it uses themb_string extensionor not. Though usuallystrlen()is overloaded withmb_strlen()anyway in those cases. Apart from that the computed values are 100% correct.The difference you might see is how text (especially multibyte strings) is visualized if you open it in a text displaying application. It is much more likely that you get a misleading information there.