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]) ) ?> 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. 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. 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... Link to comment https://forums.phpfreaks.com/topic/135495-solved-simplifying-logical-expressions/#findComment-705877 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.