Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
Selected Reading
Concatenation of two strings in PHP program
To concatenate two strings in PHP, the code is as follows −
Example
<?php $a = 1.967; $b = 1.969; $res = $a." and ".$b; echo " $res
"; if((round($a, 2)) == (round($b, 2))) { echo "\nBoth the values are equal!"; } else { echo "\nBoth the values aren\'t equal"; } ?>
Output
This will produce the following output−
1.967 and 1.969 Both the values are equal!
Example
Let us now see another example −
<?php $val1 = 'Jack'; $val2 = 'Sparrow'; echo "First Name = $val1
"; echo "Second Name = $val2
"; $res = $val1.$val2; echo "Concatenation = $res
"; ?>
Output
This will produce the following output−
First Name = Jack Second Name = Sparrow Concatenation = JackSparrow
Advertisements
