In the past few years, we've been using dynamically typed versions of PHP. However, in PHP7 we have an option to enable 'strict types':PHP RFC: Return Type DeclarationsPHP RFC: Scalar Type Declarations(Note: Scalar Type Declarations repeatedly uses the phrase weak type checking or strictly typed versus static/dynamic.) Is it right to say that PHP7 is a statically typed language? If so or not, why?
Is PHP7 a static or dynamic typed language?
php
As mentioned, strong and weak type systems are ill-defined:'Languages are often colloquially referred to as strongly typed or  weakly typed. In fact, there is no universally accepted definition  of what these terms mean. In general, there are more precise terms to  represent the differences between type systems that lead people to  call them strong or weak'.Static types can be verified at compile time. The compiler has enough information to verify static types before a program runs. (If a typed variable is used where the type is not expected, it's a compiler error.) Dynamic types cannot be perfectly determined at compile time. This doesn't mean variables in dynamic languages don't have types. It just means there's no way to be 100% certain of a variable's type until run-time.According to the PHP RFCs for return type declaration and scalar type declaration, non-typed declarations and evaluation modes are still allowed. This means not all of PHP is statically typed. As such, it doesn't make sense to call PHP a statically typed language. Instead, it's a dynamically typed language with a couple static type features.The fact that the scalar type declaration RFC actually uses the definitions strict and weak type checking is telling. The PHP folks pride themselves on not being language nerds. This is neither good nor bad. It just means the language designers are focusing on different things than, say, Haskell designers.