What is a string in PHP and how is it used in code?

A string in PHP is a sequence of characters that is used to represent text. Strings can be enclosed in single quotes ('') or double quotes (""). Strings are commonly used for storing and manipulating text data in PHP code. Example:

// Defining a string variable
$string = "Hello, World!";

// Printing the string
echo $string;