Getting rid of magic numbers in php array

105 Views Asked by At

Here's my code

$q->addNotInCondition('`t`.`id`', array(0, 1, 2));

I want to remove magic numbers in array. Is there a special way to do this or just define 0 , 1 and 2 ?

Is this correct?

const ONE= 4;
const TWO= 2;
const THREE= 4;

$q->addNotInCondition('`t`.`id`', array(ONE, TWO, THREE));
0

There are 0 best solutions below