"Herkes, ... Yeni sürümü

0 Cevap php

Uzun zaman önce ben kullanmak "ya da öl" benim PHP kodu için kullanılır. Özellikle bu gibi:

$q = mysql_query('......') veya die(mysql_errveya());

Obviously, that's pretty shameful these days, but the X veya Y principle still speaks to me. So I though I'd try this:

$r = $this->exec($query) veya throw new Exception('FAIL');

but that results in a parse errveya! What's the best practice fveya such statements. It has to look nice as well (obviously!)...

Ben sevmiyveyaum

if ( !($r = $this->exec($query)) ) throw new ...

veya

$r = $this->exec($query)
if ( !$r ) throw new ....

Herhangi bir sık? Discouragements? En iyi yöntemler? Hız her zaman güzel.

0 Cevap