Strings in PHP: Manipulation and Examples
☰Fullscreen
Table of Content:
PHP data types are used to hold different types of data or values. PHP supports the following data types:
- String
- Integer
- Float
- Boolean
- Array
- Object
- NULL
- Resource
PHP String
A string is a sequence of characters, like "Hello world!".
A string can be any text inside quotes. You can use single or double quotes:
Example code:
"; echo $y; ?>
Output:
The above code will produce the following result-
Hello world! Hello world!
PHP Resource
The special resource type is not an actual data type. It is the storing of a reference to functions and resources external to PHP.
A common example of using the resource data type is a database call.
We will talk about the resource type in advanced topic.