Book of Good Explanations: 1. Static/Dynamic Vs Strong/Weak Typing
Book of Good Explanations: 1. Static/Dynamic Vs Strong/Weak Typing
Simply put it this way: in a statically typed language the type is static, meaning once you
set a variable to a type, you CANNOT change it. That is because typing is associated
with the variable rather than the value it refers to.
For example in Java:
str = 5 + "hello"
# would throw an error since it does not want to cast one type to the other
implicitly.
whereas in PHP: