answersLogoWhite

0

What are the four scalar types of PHP?

Updated: 9/21/2023
User Avatar

Wiki User

12y ago

Best Answer

Four scalar types of PHP

String

String is used for binary data. This can be text, content of an image file etc.

$today = 'hey how are you';

Int

For numeric values, Int is used. Int can contain a positive or a negative number.

$total = 20000000;

$temperature = -14 ;

Float

Float is used for numbers that have a fractional component. Float can also contain positive or negative values.

$length = 145.78;

$growthRate = -5.216;

Sometimes name Double is used for Float values.

Boolean

Boolean is used for values that are either true or false. You would often see Boolean values in conditional statements.

if (($age > 12) && ($age < 20)) {

$teenage = true;

} else {

$teenage = false;

}

//Some content goes here

if ($teenage) {

}

User Avatar

Wiki User

12y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What are the four scalar types of PHP?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

What are the four scalar types of PHP with examples?

Boolean: true or false - $foo = true;Integer: 0 or 1 - $foo = 7;Float (Double): 0.5 or 6.2 - $foo = 5.5;String: "bar" or "foo" - $foo = "bar";


What are the types of scalar quantity?

APPLES


What are the different types of errors in PHP?

basicly four type errors in php warnings fatal notices parse and internly e_fatal e_warning e_fatal e_user_error e_user_warning e_user_fatal e_core_error e_core_warning e_compile_error e_recvoverable_error e_strict e_all


What are the types of scalar quantization?

There are two types of quantization .They are, 1. Truncation. 2.Round off.


What is CMS and its Type in PHP?

CMS is a Content Management System, Some types of CMS's that are written in PHP would be WordPress, Drupal, Joomla. Is this what you were asking?


What is scalar data?

A scalar variable can hold only one piece of data at a time. So in C, C++ and Java scalar data types include int, char, float and double, along with others. Scalar variables of the same type can be arranged into ascending or descending order based on the value. Prasangax


What is scalar data structures?

A scalar variable can hold only one piece of data at a time. So in C, C++ and Java scalar data types include int, char, float and double, along with others. Scalar variables of the same type can be arranged into ascending or descending order based on the value. Prasangax


Is the number of leaves on a tree scalar or vector?

scalar lol


Is a electric potential scalar or vector?

Electric potential is a scalar.


How many data types are there in PHP?

The data types are grouped into this categories: Booleans Integers Floating point numbers Strings Arrays Objects


Is inertia a vector or scalar?

scalar


Is time a scalar or a vector?

Scalar