• Resolved Guido

    (@guido07111975)


    Hi,

    When I have for example a table and want to select certain columns I can choose between using a php counter or a css nth selector

    Counter:

    $counter = 0;
    
    foreach (...) {
      $counter++;
    
      if($counter%4 == 0) {
        // do something
      }
      else {
        //do something else
      }
    }

    CSS nth selector:

    ul:nth-of-type(3n+1) {clear:left;}

    My question, what’s the best way of these two? What would you do?

    Guido

Viewing 6 replies - 1 through 6 (of 6 total)
Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘PHP counter vs CSS nth selector’ is closed to new replies.