Just use .
for concatenating.
And you missed out the $personCount
increment!
while ($personCount < 10) {
$result .= $personCount . ' people';
$personCount++;
}
echo $result;
More Related Contents:
- Ternary operator and string concatenation quirk?
- Removing last comma from a foreach loop
- Group subarrays by one column, make comma-separated values from other column within groups
- How to make array inside in foreach loop – php? [closed]
- Please rectify this syntax error echo ” ” Add to cart “”; [closed]
- Can anyone help me what is wrong in this code ajax using with php? [closed]
- PHP – Failed to open stream : No such file or directory
- Sort array of objects by object fields
- Get the first element of an array
- PHP Elvis operator vs null coalescing operator
- How can I store and retrieve images from a MySQL database using PHP?
- PHP preg_match to find multiple occurrences
- How to avoid echoing character 65279 in php?
- “Unknown modifier ‘g’ in…” when using preg_match in PHP?
- PHP is confused when adding and concatenating
- Parentheses altering semantics of function call result
- Add extra meta for orders in Woocommerce
- Warning: preg_match() [function.preg-match]: Unknown modifier ‘/’ [duplicate]
- Programmatically add product to cart with price change
- How come checkbox state is not always passed along to PHP script?
- How to merge two arrays by summing the merged values [duplicate]
- How can I run a php without a web server?
- How to Merge Two Eloquent Collections?
- Why does (0 == ‘Hello’) return true in PHP?
- Set character set using MySQLi
- Send FCM messages from server side to android device
- how to execute mysql command DELIMITER
- Skip Checkout in Magento for a downloadable product
- php in background exec() function
- Unit Test Laravel’s FormRequest