jeudi 27 octobre 2016

PHP, if condition with multiple 'OR' VS in if(in_array ()) Best Practices

all My question is simple, I using if condition: if($ctransaction == 'rfnd'||$ctransaction == 'refund'|| $ctransaction == 'cgbk'||$ctransaction == ...||){ ...... }

I want to change it to

if(in_array($ctransaction, array ('rfnd', 'refund', 'cgbk', ..))){ ...... }

I know that this two sentences doing the same. My question more about performance and execution speed

Thank You

Aucun commentaire:

Enregistrer un commentaire