I’m using $query, $row, etc.. variables in my code multiple time, and assigning different things to them. I wonder if it’s matter or wrong coding style? Does it affect to website or server performance anyway?
I’m using $query, $row, etc.. variables in my code multiple time, and assigning different
Share
Assigning different values to variables is fine. It’s what variables are for, really. It only becomes a problem if you assign different meanings to the variables. For example, re-using a variable called
$queryto hold something that isn’t a query can be confusing and unintuitive to anybody who has to support the code (including yourself after you’ve forgotten about it).As long as the variables maintain what they mean in the context of the code, you can re-assign them all you want.