Tools, FAQ, Tutorials:
Ways to Include Variables in Double-Quoted Strings in PHP
How Many Ways to Include Variables in Double-Quoted Strings?
✍: FYIcenter.com
There are 3 formats to include variables in double-quoted strings:
Here is a PHP script example of different ways to include variables in double-quoted strings:
<?php
$beer = 'Heineken';
echo "$beer's taste is great.\n";
echo "He drank some ${beer}s and water.\n";
echo "She drank some {$beer}s and water.\n";
?>
This script will print:
Heineken's taste is great. He drank some Heinekens and water. She drank some Heinekens and water.
⇒ Including Array Elements in Double-Quoted Strings in PHP
⇐ Including Variables in Double-Quoted Strings in PHP
2016-10-13, ∼3041🔥, 0💬
Popular Posts:
How To Avoid the Undefined Index Error in PHP? If you don't want your PHP page to give out errors as...
How to use 'choose ... when ..." policy statements to control execution flows? If you want to contro...
How to convert JSON Objects to PHP Associative Arrays using the json_decode() function? Actually, JS...
What properties and functions are supported on requests.models.Response objects? "requests" module s...
How to use the JSON to XML Conversion Tool at freeformatter.com? If you want to try the JSON to XML ...