String variables in PHP

29 14
Read Time:41 Second
Hello,

Today I will explain about String variables in PHP, PHP string variables are used to score and manipulate that data. Once we have created a string variable we can manipulate it. We can use string directly into function or it can be stored into variable.

for example:

<?php

$text=”My first string variable”;
echo $text;

?>

Here we have created s string variable called text and then assign the text My first string variable to it. and then writing the value of the text variable for the output.

There is only one string operator in PHP to join two string values together, It is known as PHP Concatenation Operator.

Here is an example to join two string variables together.

<?php

$one = “My first”;
$two = “string variable”;

echo $one .” ” .$two;

?>

—————-
output:
My first string variable

About Post Author

Vishal Barot

Hi there, Vishal Barot here. Full-time web developer and graphic designer with over 10 years of experience. I've been experimenting with web development since I was 17 years old. If you are looking to have a professional website or design then I can develop it for you. Looking forward to working with you.
Happy
Happy
16 %
Sad
Sad
13 %
Excited
Excited
16 %
Sleepy
Sleepy
21 %
Angry
Angry
17 %
Surprise
Surprise
17 %

Average Rating

5 Star
0%
4 Star
0%
3 Star
0%
2 Star
0%
1 Star
0%

Leave a Comment

Your email address will not be published. Required fields are marked *

The maximum upload file size: 1 MB. You can upload: image. Links to YouTube, Facebook, Twitter and other services inserted in the comment text will be automatically embedded. Drop files here