PHP String Operators - PHP Tutorial 35

Published: 12 September 2019
on channel: ChidresTechTutorials
1,076
16

Notes for You::PHP String Operators - PHP Tutorial 35

PHP has two string operators:
. (Concatenation operator)
- converts the LHS and RHS operands to the string format and
- forms a new string by combining them

.= (short hand concatenation assignment operator)
- converts the LHS and RHS operands to the string format and
- forms a new string by combining them and
- assigns the resultant string to left hand side variable

Note:
- It is recommended to add space before and after the string operators.


Example Code:

echo "Manjunath" . "Chidre"; // "ManjunathChidre"
echo "<br/>";
echo "Manjunath " . "Chidre"; // "Manjunath Chidre";
echo "<br/>";
echo "Manjunath" . " Chidre"; // "Manjunath Chidre";
echo "<br/>";
echo "Manjunath" . " " . "Chidre"; // "Manjunath Chidre";
echo "<br/>";
echo "<br/>";

echo "Manjunath" . "Chidre"; // "ManjunathChidre"
echo "<br/>";
echo "Score: " . 2; // "Score: 2"
echo "<br/>";
echo 2 . "Score: "; // "2Score: "
echo "<br/>";
echo 2 . 2;
echo "<br/>";
echo "<br/>";
echo "Score: " . 2 + 2; // 0 + 2 = 2
echo "<br/>";
echo "Score: " . (2 + 2); // "Score: 4"
echo "<br/>";
echo 2 + 2 . "Score: "; // "4Score: "
echo "<br/>";
echo "<br/>";

$myName = "Manjunath";
echo $myName; // Manjunath
echo "<br/>";
$myName .= " Chidre"; // $myName = $myName . " Chidre";
echo $myName; // Manjunath Chidre
echo "<br/>";
$myName .= " Aurad"; // $myName = $myName . " Aurad";
echo $myName;
echo "<br/>";

Note:
- replace < with less-than symbol.
- replace > with greater-than symbol.






=========================================

Follow the link for next video:
PHP Tutorial 36 - Special Operators in PHP | PHP Special Operators Tutorial
   • PHP Special Operators - PHP Tutorial 36  

Follow the link for previous video:
PHP Tutorial 34 - Bitwise Operators in PHP | PHP Bitwise Operators Tutorial
   • PHP Bitwise Operators - PHP Tutorial 34  

=========================================

PHP Tutorials Playlist:-
   • PHP Tutorials  

=========================================
Watch My Other Useful Tutorials:-

MySQL Tutorials Playlist:-
   • MySQL Tutorials  

HTML Tutorials Playlist:-
   • HTML Tutorials  

CSS Tutorials Playlist:-
   • CSS Tutorials  

JavaScript Tutorials Playlist:-
   • JavaScript Tutorials  

=========================================

► Subscribe to our YouTube channel:
   / chidrestechtutorials  

► Visit our Website:
https://www.chidrestechtutorials.com

=========================================
Hash Tags:-
#ChidresTechTutorials #PHP #PHPTutorial


On this page of the site you can watch the video online PHP String Operators - PHP Tutorial 35 with a duration of hours minute second in good quality, which was uploaded by the user ChidresTechTutorials 12 September 2019, share the link with friends and acquaintances, this video has already been watched 1,076 times on youtube and it was liked by 16 viewers. Enjoy your viewing!