+ 1

The type of variable is auto-defined by assigning a value to it? because in java, we have to declare the type of variable before assigning value

6th Mar 2016, 4:07 PM
ThisTNTSquid
ThisTNTSquid - avatar
2 Respostas
+ 2
PHP is Loosely typed - it will implicitly change the type of a variable as needed, depending on the operation performed on its value - as opposed to stongly typed languages (C or Java) where variables can only contain one type of data throughout their existance.
28th Apr 2016, 8:26 PM
Diana Margarit
Diana Margarit - avatar
+ 1
In Java the variable you define is limited to the particular data type you define it to, whereas PHP will automatically change the data type as per the requirement. For eg- you cannot add a string and an integer number in java but in PHP if you add $a="10" to $b=20 the output will be 30 even though the first one is basically defined as a string and second as an integer.
23rd Nov 2016, 2:36 PM
Archit
Archit - avatar