Skip to main content

The PHP Data Type

The PHP Data Types, like in any programming language, are the abc of computer languages, both for the Web and in the desktop environment; they. In human language we use words to form sentences; while in computer science data types are used to define the elements that make up a logical expression.

The PHP Data Type
The data type in PHP

The variables

Assigning the data type to the variables in languages like C for example Java, also called "typed", is mandatory; this must be done explicitly! As for PHP, being a pre-compiled language, the data type is implicitly assigned when a variable is created; to find out the type of data in a variable you can use the (get type off) function of PHP.

The primitive data types in PHP

If you can understand the data type concept, you are halfway to becoming a good developer. The PHP primitive data types are:

  • Integer (decimal integers) to contain a value ranging (from -2.147,483,647 to 2,147,483,647).
  • Float or "floating point" and double; they reach 15 digits of precision after the decimal point; values range from (-17E + 308 to 1.7E + 307) it's based on IEEE 754 standard.
  • String (sequences of characters); they must be enclosed in single quotes or double quotes.
  • Boolean is a data type that can only express two states (True / False).
To these types, also called "primitive"; only one value can be assigned at a time and for this reason they are defined as (scalars).

Compound PHP data types

The data types of PHP, "compound" are different; I dare say they are data types for advanced uses! Between these:
  • Array for (vectors and matrices).
  • Object for objects.
  • Callable for calls to callback functions.
  • Iterable is a pseudo type for iterating through data.
Except for Arrays; the rest are all PHP datatypes added later with the new language releases.

The special data types of PHP

There remain the special data type NULL which indicates the absence of value and Resource for external resources that use (HTTP POST and GET metod API function; with these latest We close the circle on the data types of the PHP language.

Comments

Popular posts from this blog

The origins of computer programming

Modern computers can process large amounts of data. Before the current computers we can only refer to the analytical machine of Charles Babbage; This machine performed calculations thanks to the rotation of gear wheels. Countess Ada Lovelace participates in the creation of Charles Babbage's analytical machine by decoding the language to make it work; US Department of Defense dedicates the ADA programming language in the name of the Countess.  The role of women in computer science  Apparently, the position of women in the history of computer programming seems to cut out only a marginal role; in reality, it is not so! As already mentioned in the previous paragraph; without the contribution that Countess Ada Lovelace left to the world of information technology; this science could be decades behind. The origins of computer programming languages  The origins of programming languages were determined by a mechanical and mostly experimental approach; with reference to the an...

Learn to use the computer

Many people use the PC every day to connect to the network and to work but without knowing what the computer is and wondering how this is possible. We put a computer to work every time we buy with a credit card, withdraw from an ATM, pay a postal order, buy a train ticket, play video games and many other things. Understanding how the PC works inside is too much but starting from its components and the origins of  IT is already a good start. Learn to use the computer Basic computer components The computer is made up of several electronic components on printed circuits that interact with each other via micro pulses; if you want to learn how to use the computer, the main components of a PC are: A central processing unit (CPU); the "processor" used to process active processes on the data before outgoing transmission. RAM memories (random access memory) in which the bytes for processing are loaded; it is the dynamic memory of the computer and it is volatile; A graphics processing...

CMS Content Management System

Anyone who wishes to construct and administer a website without knowing how to code should consider using content management systems (CMS). A content management system (CMS) is a piece of software that makes it simple to add and alter material to websites without changing the underlying code.  Because of this, CMSs are a fantastic option for organizations and people who lack the technical know-how to build a website from scratch.  CMS  How many types of CMS exist? There are several available CMSs, each with unique benefits and drawbacks. The most well-liked CMSs include: WordPress Drupal  Joomla  Magento  Shopify  TYPO3 Picking the CMS that best meets your needs is vital since each one has unique features and functions. Gins that are offered. If You learn PHP, Javascript, HTML and CSS programming language You can create Your personal CMS. Who can use a CMS?  Anyone who wants to build and administer a website without knowing how to code will find C...