I have a variable stack in object form:
- $people->one
- $people->two
- $people->three
- $people->four
I also have an array of data that when applicable, I want to replace those values. The array has things like: Lets call the array $stats
- "two" => 1
- "four" => 14
What I have been trying to accomplish (and this was using the double variable, is replace the value in the original object stack with an updated value if in the array.
foreach ($stats as $key => $value) {
$data = "people->" . $key;
$$data = "<strong>" . $$data . "</strong>";
}
But, that just doesn't look like it should work, and isn't as clean as I would like it. Is there a better way to handle something like this?
Thanks for any help that can be provide.
^^^
Update:
Basically I am trying to wrap around a variable, if the variable shows up in the array. And, then have it print like the original value, except with the wrapped around it.