Topic

parameter-expansion

14 articles, page 1 of 2

Bash

strlen() in Bash: Get the Length of a String

Bash's ${#var} counts characters, PHP's strlen() counts bytes. A clean strlen() function, a strbytes() companion, and the locale traps in between.

6 min read, updated 17 Oct 2026