fatkatie Posted February 7, 2017 Share Posted February 7, 2017 if(trim($row->mysql_field == 0)) { Is that a valid construct? It reads obtain the field and compare to zero. The result is boolean; true or false. Then trim it? I can't figure out what the author really wants to do here. Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/303127-iftrimrow-mysql_field-0-is-this-a-valid-construct/ Share on other sites More sharing options...
Solution benanamen Posted February 7, 2017 Solution Share Posted February 7, 2017 (edited) Forget the author. Just do (True example. Yours is a false example) If true if($row->mysql_field){ //Do something } This example is also in the manual. Couldn't find the page at the moment. if false (Your example) if(!$row->mysql_field){ //Do something } Edited February 7, 2017 by benanamen Quote Link to comment https://forums.phpfreaks.com/topic/303127-iftrimrow-mysql_field-0-is-this-a-valid-construct/#findComment-1542429 Share on other sites More sharing options...
Jacques1 Posted February 7, 2017 Share Posted February 7, 2017 Is that a valid construct? It's “valid” in the sense that PHP can handle it, but it's nonsense. Either there's a typo, or the author doesn't know what he's doing. Quote Link to comment https://forums.phpfreaks.com/topic/303127-iftrimrow-mysql_field-0-is-this-a-valid-construct/#findComment-1542430 Share on other sites More sharing options...
fatkatie Posted February 7, 2017 Author Share Posted February 7, 2017 Yah, I was thinking it was some kind of php idiom. Haven't been at this language long. Thanks both of you. Quote Link to comment https://forums.phpfreaks.com/topic/303127-iftrimrow-mysql_field-0-is-this-a-valid-construct/#findComment-1542431 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.