PHP string concatenation [duplicate]

Just use . for concatenating.
And you missed out the $personCount increment!

while ($personCount < 10) {
    $result .= $personCount . ' people';
    $personCount++;
}

echo $result;

Leave a Comment