Split for loop to precentage

Discussion in 'PHP' started by astrazone, Jun 1, 2011.

  1. #1
    I have 3 types of items.
    $items = array(40,10,50);//Can be more elements

    $n = 100;

    for($i = 0 ; $i < $n; $i ++){
    //Heres the tricky part.
    //Item one should be when 0 < i <= 40
    //Item two should be when 40 < i <= 50
    //Item three should be when 50 < i <= n
    }
    How exactly can I do it?

    Thanks in advance.. :)
     
    astrazone, Jun 1, 2011 IP