Embed variables directly into strings : String Interpolation « String « PHP






Embed variables directly into strings

 
<?php

$a = 10;
$b = 15.7;
echo "The value of \$a is $a and the value of \$b is $b\n";
echo 'The value of \$a is $a and the value of \$b is $b\n';
?>
  
  








Related examples in the same category

1.Adding "s" to the end of the variable name
2.Embedded Conditionals
3.Embedding numbers and strings into other strings
4.Interpolating with curly braces