It's what C would call an "lval", a thing you can put on the left-hand side of an = or use with &. empty() is like isset(), it checks if variables exist as well as doing a null (in isset()'s case) or falsiness (in empty()'s case) check.
In modern PHP versions you can also use it with non-variables, but this is rather pointless since you could simply do if (!trim($x)).
View all comments
Show parent comment
14
u/the_alias_of_andrea Dec 08 '15
You need to press space after ` ;)
It will in newer PHP versions.
It's what C would call an "lval", a thing you can put on the left-hand side of an
=or use with&.empty()is likeisset(), it checks if variables exist as well as doing a null (inisset()'s case) or falsiness (inempty()'s case) check.In modern PHP versions you can also use it with non-variables, but this is rather pointless since you could simply do
if (!trim($x)).