Home / Learn / PHP Basics / PHP Data Types

PHP Data Types

There are many different data types in PHP and they are String, Integer, Float, Boolean, Array, Object and NULL and Resources

3 years ago

113

Code Example

<?php

# string
$aString = 'String can be defined in a single quote';

$anotherString = "String can also be defined in double quotes";

# integer
$age = 10;

# float
$pie = 3.142;

# boolean
$isHungry = false;

$isProgramming = true;

# array
$thingsToBuy = [
	'eggs',
	'noodle',
	'honey'
];

# object
class Person {}

$johnDoe = new Person();
                    

Code Snippets

Collection of Laravel, AlpineJS, VueJS, Tailwind CSS, Flutter snippets and more. New snippets added every day.
View Snippets

Code Components

Collection of Tailwind CSS components for everyone to use. Browse all of the components that's right for your web projects
View Components

Welcome to PostSrc V3

PostSrc Dark Logo

You have to login to favorite this