PHP每次迭代增加字符串值

I want to increment the int on the end of my string which together makes up the complete value.

$btnid = 'btnid1';

 for($i = 1; $i < $countP; $i++) {
     $btnid = 'btnid' . ++;
 }

I tried different types of concatenation but I can't seem to get it to work if I just set it to 1 it works but I need the string there too.

Just append $i to the string btnid in each loop iteration.

$string = 'btnid';
for($i = 1; $i < $countP; $i++) {
     $btnid   = $string . $i;
}

As a side note (and seriously, DO NOT actually do this) so long as you don't go past btnid9, you can just increment the string.

$btnid = 'btnid1';
for($i = 1; $i < 9; $i++) {
    $btnid++;
}
echo $btnid; // btnid9

If you go over, things get a bit weird:

$btnid++;
echo $btnid; // btnie0

Manual page: http://php.net/manual/en/language.operators.increment.php