Use empty() instead of strlen()

enricodias4654

Member
YetiShare User
Jan 13, 2015
411
1
16
Hello.

In the entire script I see the use of strlen() to check if a variable is empty, like if(strlen($var) ==0). empty() is at least 6 times faster than strlen(). It's a tiny improvement, but it's kind of weird to use strlen() to check if something is empty.

empty() is not a function but a language construct, has its own opcode. Therefore, it doesn't need to be looked up in the function table and it can do more specialized parameter parsing.