Experienced programmers have found that using isset() in PHP to determine the string length is faster than strlen() and has higher execution efficiency.
That is:
Why isset() is faster than strlen()
strlen() function executes quite quickly because it does not do any calculations and only returns the data in the zval structure (C’s built-in data Structure used to store known string lengths stored in PHP variables). However, since strlen() is a function, it will be somewhat slow, because the function call will go through many steps, such as lowercase letters (Annotation: refers to the lowercase function name, PHP does not distinguish between uppercase and lowercase function names), hash search, Will be executed together with the called function.
In some cases, using the isset() trick can speed up the execution of your code. Because isset() is a language construct, it means that its execution does not require function lookup and letter lowercase. That is, you actually don't spend much overhead in the top-level code checking the string length.
So calling isset() is faster than strlen().