On PHP7 we know that a variable has to be inizialized with its type, differnet from where we did on php5 that the type was changed according the value set.
If we test this code
<?php
/* EAMPLE A */
$tLisTim="";
$i=0;
$tLisTim[$i]=100;
$i=$i+1;
$tLisTim[$i]=200;
var_dump("A");
var_dump($tLisTim);
/* EAMPLE B */
$tLisTim=[];
$i=0;
$tLisTim[$i]=100;
$i=$i+1;
$tLisTim[$i]=200;
var_dump("B");
var_dump($tLisTim);
?>
we will get this results:
PHP 5.6
string 'A' (length=1)
array (size=2)
0 => int 100
1 => int 200
string 'B' (length=1)
array (size=2)
0 => int 100
1 => int 200
PHP 7.1
string 'A' (length=1)
string '12' (length=2)
string 'B' (length=1)
array (size=2)
0 => int 100
1 => int 200
The problem is that in PHP7 there is not warning to help us to migrate correctly all this differences.
How can I detect when we try to use a variable with an incorrect type ?
Thanks,
is_*where * is the type you would expect ? like php.net/manual/en/function.is-array.php. But to be honest why do you have in your code an empty string and expect to change it into array ?