php array displaying in advance form -


this array

$list=array('first','second','third','fourth','fifth','sixth','seventh','eighth','ninth','tenth','eleventh','twelvelveth','thirteenth'); 

i want display :

first line : first,second,third,fourth,fifth,sixth,seventh,eighth,ninth,tenth,eleventh,twelvelveth,thirteenth

second line : second,third,fourth,fifth,sixth,seventh,eighth,ninth,tenth,eleventh,twelvelveth,thirteenth,first

third line : third,fourth,fifth,sixth,seventh,eighth,ninth,tenth,eleventh,twelvelveth,thirteenth,first,second

fourth line : fourth,fifth,sixth,seventh,eighth,ninth,tenth,eleventh,twelvelveth,thirteenth,first,second,third

and on dynamically.

when add value or delete values on main array. output should change.

//this wuill work <?php //list array $list=array('first','second','third','fourth','fifth','sixth','seventh','eighth','ninth','tenth','eleventh','twelvelveth','thirteenth');  //get count $count = count($list);  $val = ''; //loop value for($i=0; $i<$count; $i++) {     //skip 1 value     $pop = array_shift($list);      //appentd value     $val .= $pop.',';      //display value     echo implode(',', $list).','.substr($val, 0, -1).'<br/>';  } 

Comments