PHP always needs to know the "current type" of a value before it can use it for any purpose, including initializing a variable. This "current type" is metadata (an enumeration) that goes together with all values.
In your example code the casts are meaningless because you are initializing variables using literal values, which are always of the obvious type:
$s = "foo";
echo is_string($s); // 1
$s = (string)"foo";
echo is_string($s); // also 1
The same goes for the integer and array.
There is at least one case where the type of the variable would be something other than you might expect at first sight:
$i = PHP_INT_MAX + 1; // or use something like 999999999999
echo gettype($i); // "double"!
In this case using a cast would make $i
an integer, but it would also change its value:
$i = (int)(PHP_INT_MAX + 1);
echo gettype($i); // "integer"
echo $i; // a very large negative number -- what?!?
Of course this is not caused by a missing cast, but is rather an artifact of how numbers are treated in PHP. So the conclusion is clear: there is no point in using casts when initializing with literals.
If you are initializing a variable that you intend to use as type X with a value that is of a different type Y (or of an unknown type) then there is a reason to use an explicit cast: documenting in code how the variable is going to be used going forward. But don't overestimate the benefit: this information is only for human consumption; PHP will automatically do the usual type conversions whenever you try to use a variable as a different type than it is.