Skip to content

DataOps Blog

Just another DataOps site

  • Home
  • certification
  • consultant
  • consulting
  • Contact Us!
  • courses
  • Intro to Laravel
  • tools
  • trainer
  • training

PHP | Data Types

December 24, 2021
By Manish Kumar In JavaScript

PHP | Data Types

Values & Types | PHP Guide

In PHP, Data types are used to declare one particular type of data as in all programming languages. Data Types define the type of data a variable can store.
PHP supports 8 primitive data types that can be categorized further in 3 types:

  1. Scalar Types (predefined)

This particular data types holds only single value. There are 4 scalar data types in PHP.

  • String

A string is a non-numeric data type. It holds letters or any alphabets, numbers, and even special characters. String must be written either within single quotes or in double quotes, both acceptable.

  • Integers

Integers hold only whole numbers including positive and negative numbers.

Rules for integers:

An integer must have at least one digit.

An integer must not have a decimal point.

An integer can be either positive or negative.

  • Float

Float is a number with a decimal point or a number in exponential form. It can hold numbers with a fractional or decimal point, including a negative or positive sign.

  • Booleans

Booleans are one of the simplest data type in PHP. It hold only 2 values TRUE and FALSE. It is mainly used in conditional statements.

2. Compound Types

This particular data types holds multiple values. There are 2 compound data types in PHP.

  • Array

An array is a compound data type that can store multiple values with same data type in a single declared variable.

  • Objects

Objects are the instances of user-defined classes that can hold both values and functions and information for data processing specific to the class.

Objects are declared and created from the new keyword.  

3. Special Types

There are 2 special data types in PHP.

  • Null

These are special types of variables that can hold only one value NULL, which is intentional declared to be null. There is a convention of writing it in capital letters as it is case sensitive written in capital letters.

  • Resources

Resources in PHP are not an exact data type. These are basically used to store references to some function call or to external PHP resources. This is an advanced topic of PHP.

Let’s take an example for all above data types:

Summary

After reading this blog, you should have a better clear concept of some of the major data types that are available in PHP. Each of these data types will become important with a particular role as you develop programming projects in the PHP language.

I hope you find this particular blog helpful and informative about data types in PHP.

Keep practicing and exploring, there are lot more to know.

Thank you!!

composer css html javascript jquery Laravel laravel-form MySQL php xampp
Written by:

Manish Kumar

View All Posts

Recent Posts

  • The Online Dating Association (ODA) Maintains the Gold Standard for online dating sites in britain
  • Tips Balance On The Internet And Typical Dating
  • meet black gay men Gay Hookups
  • (no title)
  • (no title)
  • Online Casinos Offer No Deposit Casino Bonus Codes
  • A Board Website Review
  • How you can Remove Disease From ipad device
  • Dating – When You Should Discuss Dirty Little Methods?
  • How to Find the Top Canadian Online Casino
  • Research Papers For Sale
  • Free Slot Machine Games – Tips to Play Slots Free
  • (no title)
  • Why Use a VPN Online?
  • The very best GTA Games
  • DesignLab Xbox 360 – Create Your Very Own Controllers
  • Tips on how to Conduct Individual Businesses
  • Tips on how to Download the Best Android Programs
  • Finest Antivirus Totally free
  • VPN USA — Protect Your web Privacy and Unblock Geo-Restricted Content

Archives

Categories

Meta

  • Log in
  • Entries feed
  • Comments feed
  • WordPress.org
  • Free Video Tutorials
  • DevOps School
  • Best DevOps
  • scmGalaxy
  • Artificial Intelligence
  • DataOps
  • AIOps
  • GuruKul Galaxy
  • DevOps Consulting
  • DevOps Freelancers
  • DevOps Trainer
  • Free Ebooks
  • School for Debugger
  • Holiday Landmark
  • Surgery Planet
  • My Hospital Now
  • My Medic Plus
  • ProfessNow
  • Cotocus
  • Stocks Mantra
  • I Reviewed

Proudly powered by WordPress | Theme: BusiCare by SpiceThemes