+ 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
2 odpowiedzi
+ 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.
+ 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.