+ 19
Why php is called loosely typed language ?
6 Answers
+ 12
In PHP you can do things like `10 + "10" + true` and it it will run fine (the result is 21).
Here PHP automatically converted different types to numbers, which is called type coercion.
Strongly typed languages would throw an error here, because you can't add numbers and strings.
PHP also allows you to declare a variable as one type, and then switch types.
For example
$x = 10;
$x = "Hello";
will run without problems; strongly typed languages would throw an error here, because $x was first defined as a number, and you can't store a string in a number variable.
Weak/Loose typing has fallen out of fashion a bit because it can lead to many bugs.
+ 4
Loosely typed languages refer to those programming scripts that do not require defining the variable. To put it simply, while declaring a variable in these programming scripts, there is no need of defining or classifying the data type stored in them.
0
hello
- 1
$Ă=10
- 1
Hlo
- 1
I have no idea sorry