eugeniu Posted July 19, 2009 Share Posted July 19, 2009 I found this bit of code in an example script that seems to use strlen as a function that outputs true or false: if (!$item || strlen($item = trim($item)) == 0) { ... Is that code valid? For me, it seems to do what it's supposed to, determine if $item is set, but how does it actually do that? And... what is the use for trim here? Link to comment https://forums.phpfreaks.com/topic/166467-very-quick-question/ Share on other sites More sharing options...
Bendude14 Posted July 19, 2009 Share Posted July 19, 2009 They are using trim to make sure it is not set with whitespace only... What is it you are trying to do? you would probaby be better with isset() or empty() Link to comment https://forums.phpfreaks.com/topic/166467-very-quick-question/#findComment-877821 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.