Site icon TestingDocs.com

PHP String Variables

Overview

In this tutorial, we will learn about PHP String variables. We will learn how to define, output, and concatenate strings. A string is a character sequence. In PHP String variables are enclosed either in double quotes or in single quotes.

Syntax

The Syntax to declare a string variable in PHP language
is as follows:

$stringVariable = “The String Value goes here”;

Concatenate Strings

Strings in PHP are concatenated using the dot operator (.)

Example

<?php
$str1 = “Hello “;
$str2 = “World!”;
echo $str1.$str2″;
?>

PHP Tutorials

PHP Tutorials on this website:

https://www.testingdocs.com/php-tutorials/

More Information on PHP

https://www.php.net/

Exit mobile version