Not sure if there’s a php function that can help determine this.
I have some strings with variable characters. My problem is how long the string is, not how many characters there are.
$str1 = '123456789';
$str2 = 'akIOuNBGH';
Both have 9 characters. However, the second is slightly longer in the browser, due to wider characters.
Ultimately I’d like to append ‘………….’ a series of dots after the two strings, but since the second and first are not the same width, the uniformity is off.
Any cool ideas or ways on how to determine string width?
Perhaps, if I know the width values, I can code the appended information appropriately.
As vucetica mentioned monospaced fonts like
CourierorCourier Newcould help you to archive equal spacing between characters.Also if you want to make sure that all strings are same length for example 32 characters you can use
sprintfmethodMore syntax examples can be found in PERL documentation, 90% of which works in php