TankedShark Posted December 4, 2008 Share Posted December 4, 2008 They're a little unwieldy, but they work. Can they be made simpler? <?php if ( ($grid[$startrow - 1][$startcolumn] != '') && ($grid[$startrow - 1][$startcolumn] != '#') ) if ( ($grid[$startrow + count($word)][$startcolumn] != '') && ($grid[$startrow + count($word)][$startcolumn] != '#') ) if ( ($grid[$startrow + $letter][$startcolumn]) == '' || ($grid[$startrow + $letter][$startcolumn] == $word[$letter]) ) ?> Quote Link to comment https://forums.phpfreaks.com/topic/135495-solved-simplifying-logical-expressions/ Share on other sites More sharing options...
.josh Posted December 4, 2008 Share Posted December 4, 2008 at face value, no, not really. Quote Link to comment https://forums.phpfreaks.com/topic/135495-solved-simplifying-logical-expressions/#findComment-705860 Share on other sites More sharing options...
TankedShark Posted December 4, 2008 Author Share Posted December 4, 2008 Bummer. Thanks, though. Quote Link to comment https://forums.phpfreaks.com/topic/135495-solved-simplifying-logical-expressions/#findComment-705863 Share on other sites More sharing options...
.josh Posted December 4, 2008 Share Posted December 4, 2008 eh. well, I mean, you can do this: <?php $array = array('','#'); if (!in_array($grid[$startrow - 1][$startcolumn], $array)) if (!in_array($grid[$startrow + count($word)][$startcolumn], $array)) if ( ($grid[$startrow + $letter][$startcolumn]) == '' || ($grid[$startrow + $letter][$startcolumn] == $word[$letter]) ) ?> IMO it's not really 'simpler' but I guess it's a few less chars of coding... Quote Link to comment https://forums.phpfreaks.com/topic/135495-solved-simplifying-logical-expressions/#findComment-705877 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.