I have the following:
$first = $index % 2 == 0 ? 'partial_one' : 'partial_two';
$last = $index % 2 == 0 ? 'partial_two' : 'partial_one';
I have a feeling there is a shorter way to do this. Anyone?
I have the following:
$first = $index % 2 == 0 ? 'partial_one' : 'partial_two';
$last = $index % 2 == 0 ? 'partial_two' : 'partial_one';
I have a feeling there is a shorter way to do this. Anyone?
This is not shorter, but in my opinion more readable:
if ($index % 2 == 0) {
$first = 'partial_one';
$last = 'partial_two';
}
else {
$first = 'partial_two';
$last = 'partial_one';
}