PHP Developer Question:
Download Job Interview Questions and Answers PDF
How you can include variables in Double-Quoted Strings in PHP?
![PHP Developer Interview Answer PHP Developer Interview Question](https://globalguideline.com/public/images/interview/12.png)
Answer:
Variables included in double-quoted strings will be interpolated. Their values will be concatenated into the enclosing strings. For example, two statements in the following PHP script will print out the same string:
<?php
$variable = "and";
echo "part 1 $variable part 2 ";
echo "part 1 ".$variable." part 2 ";
?>
This script will print:
part 1 and part 2
part 1 and part 2
<?php
$variable = "and";
echo "part 1 $variable part 2 ";
echo "part 1 ".$variable." part 2 ";
?>
This script will print:
part 1 and part 2
part 1 and part 2
Download PHP Developer Interview Questions And Answers
PDF
Previous Question | Next Question |
Tell me how many escape sequences are recognized in Double-Quoted Strings in PHP? | How many ways to include the variables in Double-Quoted Strings in PHP? |