Syntax
"$variable_name"
"{$variable_name}"
Example
echo "Hi $first_name, you are $age years old\n";
echo "Hi {$first_name}, you are {$age} years old\n";
in_place_substitution_demo.php
#!/usr/bin/php
<?php
$first_name = 'Krishna';
$age = '32';
echo "Hi $first_name, you are $age years old\n";
echo "Hi {$first_name}, you are {$age} years old\n";
?>
Output
$./in_place_substitution_demo.php
Hi Krishna, you are 32 years old
Hi Krishna, you are 32 years old
No comments:
Post a Comment