Bonesnap;11043557 wrote:I always assign my data to new variables. Saves time when using the variables later via the code intelligence of my IDE (auto complete).
If I need to see the source of the data I scroll up to the top of the file since that's where the variables are declared and assigned their values (usually in a series of ternary operators).
Yes, many people do this, and I won't say I never do this, but I try to minimize it these days, especially avoiding the extreme case of:
$foo = $_POST['foo'];
echo "<p>$foo</p>";
😉
And really, if you're only going to use that post/get/whatever value in one or two places, you're net saving in typing could be a negative number of characters -- but it's certainly not a hard and fast rule I follow, but I'm definitely less likely to just willy-nilly assign such values to scalar variables now.