Home > Net >  php foreach count rows with style positions
php foreach count rows with style positions

Time:01-07

I'm trying to create Contest list of users in php.

But my code style don't give me what I want

My code:

<?php

$users = ["129292199", "616161616", "272727272", "555554433", "666665886"];
$count = 0;

foreach ($users as $name){
    $count  = 1;
    echo  "{$count} $name\n";
}

?>

My code output

1 129292199
2 616161616
3 272727272
4 555554433
5 666665886

But I want something like this

           
  •  Tags:  
  • php
  • Related