I would like to know if there is anyway I can do this without having to do the same If loop in each of the Switch cases since it's a bit repetitive.
switch ($val) {
case 1:
if(!$object->doSomething1()==$goodValue)
row .= $object->doSomething();
break;
case 2:
if(!$object->doSomething2()==$goodValue)
row .= $object->doSomething();
break;
case 3:
if(!$object->doSomething3()==$goodValue)
row .= $object->doSomething();
break;
}