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


How many data types are there in PHP?

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


What is 10 percent in Php 250?

Answer: Php 2510% of Php 250= 10% * Php 250= 0.10 * Php 250= Php 25


Is scalar quantiy is added with vector quantity?

No, a scalar quantity cannot be added to a vector quantity directly. They belong to different types of quantities - scalars have only magnitude while vectors have both magnitude and direction. To add a scalar to a vector, you would need to convert the scalar to a vector by giving it a direction and then perform vector addition.


What are the different commands in php?

PHP doesn't use typical computer commands, typed in command prompt. PHP is a server-side scripting language and it uses functions, classes, objects, conditional statements, loops, operators, various data types and some other language constructs.


Is mass is scalar?

No, mass is not a scalar quantity. It is a scalar quantity. Scalars have only magnitude and no direction.