PHP Data Types

Variables can store data of different types, and different data types can do different things.

PHP supports the following data types:

  • String
  • Integer
  • Float (floating point numbers – also called double)
  • 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:

<!DOCTYPE html>
<html>
<body>

<?php 
$x = "Hello world!";
$y = 'Hello world!';

echo $x;
echo "<br>"; 
echo $y;
?>

</body>
</html>

Output

Thanks for reading our blog if you have any issue please leave your query in a omment box.