I came across a tutorial and when we reinitialize a variable that has a value , instead of removing the value , the variable still has the previous value .
I the 3 rd var_dump i am expecting NULL
, but it prints volvo
.
isn't this creating confusing things in the code .
$carName;
var_dump($carName);
$carName = "Volvo";
var_dump($carName);
$carName;
var_dump($carName);
NULL
string(5) "Volvo"
string(5) "Volvo"
I also saw that javascript
has the same behavior .
Is this a good feature of the language or a bad feature . According to my idea , this is bad , please explain . thanks in advance .
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…