‘.’ operator is used to concatenate two strings.
Example
$msg = "Hello " . $name . ", you are from " . $country . " and you are " . $age . "years old";
Find the below working application.
string_concatenation_demo.php
#!/usr/bin/php
<?php
$age = 23;
$name = "Krishna";
$country = "India";
$msg = "Hello " . $name . ", you are from " . $country . " and you are " . $age . "years old";
echo $msg?>
Output
$./string_concatenation_demo.php
Hello Krishna, you are from India and you are 23years old
Previous Next Home
No comments:
Post a Comment