A long time ago I used to use "or die" in my PHP code. Especially like this:
$q = mysql_query('......') or die(mysql_error());
Obviously, that's pretty shameful these days, but the X or Y principle still speaks to me. So I though I'd try this:
$r = $this->exec($query) or throw new Exception('FAIL');
but that results in a parse error! What's the best practice for such statements. It has to look nice as well (obviously!)...
I don't like
if ( !($r = $this->exec($query)) ) throw new ...
or
$r = $this->exec($query)
if ( !$r ) throw new ....
Any favourites? Discouragements? Best practices? Speed is always nice.