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. This blog is a space where I share insights, experiences, and knowledge about the digital world. From programming languages I’ve mastered to internet scams and fraud to watch out for, you’ll find a mix of practical tips and cautionary tales. Whether you're a fellow developer, designer, or just a curious reader, I hope my posts provide value and spark your interest.
Happy
Happy
10
Sad
Sad
8
Excited
Excited
10
Sleepy
Sleepy
13
Angry
Angry
11
Surprise
Surprise
11

Leave a Comment

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

Scroll to Top