I landed on this link: https://developers.google.com/speed/articles/optimizing-php
And then he searched the variable copies and found the following: To copy or not to copy additional variables in PHP?
So, I understand the above concepts, but as far as I understand, the code below is actually good practice, but sorta contradicts the instructions not to copy. Its almost like "not copying" should have a condition. Ive always understood that making a function call in each cycle is more resource intensive than storing (copying).
$total = total();
for($i=0; $i<$total; $i++){
}
The same goes for (the best example I could come up with for a Google example):
<?php
$description = strip_tags($_POST['description']);
?>
<img src="" alt="<?php echo $description ?>" title="<?php echo $description ?>" data-description="<?php echo $description ?>" />
, :
<img src="" alt="<?php echo strip_tags($_POST['description']) ?>" title="<?php echo strip_tags($_POST['description']) ?>" data-description="<?php echo strip_tags($_POST['description']) ?>" />
, , " " ?