Why data type are not using in php? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

Why data type are not using in php?

20th Feb 2018, 12:57 PM
Lavina Vaishnav
Lavina Vaishnav - avatar
8 Answers
+ 5
you can set the type of variable by using the settype command for eg <?PHP $name = "Lavina Vaishnav123"; settype ($name,"integer"); ?> The output will be the 123 as the command picks out the integer from the string.
20th Feb 2018, 1:08 PM
Kevin David
Kevin David - avatar
+ 3
variables are declared in PHP by using $ like $name = "Lavina Vaishnav"
20th Feb 2018, 12:59 PM
Kevin David
Kevin David - avatar
+ 3
actually my question is👆
20th Feb 2018, 1:00 PM
Lavina Vaishnav
Lavina Vaishnav - avatar
+ 3
PHP is known as a loosely typed language it can declare wether a variable is a string, int or array on its own
20th Feb 2018, 1:01 PM
Kevin David
Kevin David - avatar
+ 3
but already php have many data type like int ,float and also boolean .
20th Feb 2018, 1:03 PM
Lavina Vaishnav
Lavina Vaishnav - avatar
+ 3
thank you for best explanation 😊👆
20th Feb 2018, 1:10 PM
Lavina Vaishnav
Lavina Vaishnav - avatar
+ 1
welcome
20th Feb 2018, 1:13 PM
Kevin David
Kevin David - avatar
+ 1
@Immortal you r right
20th Feb 2018, 3:32 PM
Kevin David
Kevin David - avatar