I have a foreach loop in a PHP script that outputs icons / links from a database. I've used this question to use str_replace to change some values after the icons are rendered.
foreach ($icons as $ic)
{ echo str_replace('{{EMP_NO}}', $_SESSION['EmpNo'], $ic['url']) . ' '; }
I need to do a similar operation on a value {{FIRST_NAME}} but when I append with a second str_replace the second command / value is ignored. Like this:
foreach ($icons as $ic)
{ echo str_replace('{{EMP_NO}}', $_SESSION['EmpNo'], $ic['url']) . ' '; }
{ echo str_replace('{{FIRST_NAME}}', $_SESSION['FirstName'], $ic['url']) . ' '; }
When I try to combine them like this it doubles the icons output which I don't want:
foreach ($icons as $ic) { echo str_replace('{{EMP_NO}}', $_SESSION['EmpNo'], $ic['url']) . ' '; echo str_replace('{{FIRST_NAME}}', $_SESSION['FirstName'], $ic['url']) . ' '; }
How do I also str_replace {{FIRST_NAME}}?