Explain various data types of PHP?

Posted by Prem Tiwari | Updated on

Explain various data types of PHP?

There are different data types in PHP:

  • String: a sequence of characters, e.g.,” Hackr.io.”
  • Float: a floating-point (decimal) number, e.g., 23.456
  • Integer: an integer, e.g. 12
  • Boolean: represents two states – true, false.
  • Object: stores values of different data types into single entity, eg. apple = new Fruit();
  • Array: stores multiple values of same type, eg. array(“red”, “yellow”, “blue”)
  • NULL: when no value is assigned to a variable, it can be assigned NULL. For example, $msg = NULL;

If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.

Related Questions & Answers