Variables contain data, not logic. When you set a variable, you're setting it to a particular value, not the rules for computing that value. If you want something that returns different results at different times, you need something more like a function:
func_c() {
echo "<div class=\"pet_a\">$var_a</div><div class=\"pet_b\">$var_b</div>"
}
var_a="cat"
var_b="dog"
echo "$(func_c)" # echoes '<div class="pet_a">cat</div><div class="pet_b">dog</div>'
var_a="fish"
var_b="whale"
echo "$(func_c)" # echoes '<div class="pet_a">fish</div><div class="pet_b">whale</div>'
Note that executing a function uses the syntax $(functionname) (this can actually be used with any command), instead of just $variablename for variables. Also, you should almost always put both function and variable references in double-quotes (as I did above). Also also, if you're really just printing the result, don't use echo "$(functionname)" as I did above, just use functionname directly. Finally, it's generally bad practice to make functions depend on global variables (var_a and var_b) -- they should receive the data they're going to operate on as arguments:
func_c() {
# Usage: func_c var_a var_b
echo "<div class=\"pet_a\">$1</div><div class=\"pet_b\">$2</div>"
}
func_c "cat" "dog" # echoes '<div class="pet_a">cat</div><div class="pet_b">dog</div>'
func_c "fish" "whale" # echoes '<div class="pet_a">fish</div><div class="pet_b">whale</div>'
var_d="$(func_c "ferret" "weasel")" # sets var_d to '<div class="pet_a">ferret</div><div class="pet_b">weasel</div>'
(I used more double-quotes than are strictly necessary in the above example -- but it's better to use them when not needed than to leave them off when they are needed.)