Is this good practice and is there any chance of fubar if i assign slightly changed value of variable to itself?
e.g.
$myVar = 1;
$myVar = $myVar + 33959902;
$myVar = rtrim($myVar,2);
$myVar = explode(",",$myVar);
i know this will work but is this safe to do so in PHP?
This violates the practice of using good variable names -- if the variable truly represents the same thing then I would consider re-assigning to it. As it does not represent the same thing in this case, I consider it "bad" or "code smell".
(It will, however, "work safely" otherwise.)
Happy coding.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With