"$计数{$current}”;如何在php中解释这些代码


"$count{$current}" how this code will be interpreted in php?

我刚刚看到一段php代码。我找不到解释者将如何评估$newstring .= "$count{$current}";语句。

$string = "111221";
for($i = 0; $i < strlen($string); $i++) {
$current = $string[$i];
$count = 1;
while(isset($string[$i + $count]) && ($string[$i + $count] == $current)) $count++;
$newstring .= "$count{$current}";
$i += $count-1;
}
print $newstring;

任何人请解释这条线路"$count{$current}"。我想双引号是用于字符串的类型转换。但是,$count$current应该是数字。那么花括号的含义是什么呢?

$newstring .= "$count{$current}";

是一样的

$newstring .= $count . $current;