Here is a great article about Static vs. Dynamic typing and Strong vs. Weak typing.
But as to summarize it ; Dynamic typing languages are which variables’ type declarations are not mandatory and they will be generated on the fly, by their first use [PHP, Python]. While Static typing languages are the ones which variable declarations are mandatory before usage [Java, C].
/* C code */ static int num, sum; num = 5; sum = 10; sum = sum + num;
/* PHP Code */ $sum = 10; $sum++; echo $sum;
On the other hand the difference between Strong and Weak typing is different; Strong typing is when a variable is declared as a specific type (no matter by Dynamic or Static typing) it is necessarily bound to that particular data type [Python, Java]. While in Weak typing variables are not of a specific data type ; it does mean that variables are not “bound” to a specific data type [C,PHP] .
# Python code >>> foo = "x" >>> foo = foo + 2 >>>>> Traceback (most recent call last): File "", line 1, in ? foo = foo + 2 TypeError: cannot concatenate 'str' and 'int' objects >>>
/* PHP code */ $foo = "x"; $foo = $foo + 2; // not an error echo $foo;