Not sure if this is the correct approach, but this is the only one that is coming to me right now, so new suggestions are welcome! I am trying to detect what a string says, and based on that, replace it with custom information inside a foreach.
foreach($customfields as $field)
{
if($field->title == 'Date of Birth')
{
$title = str_replace($field->title, 'Date of Birth', 'Data urodzenia');
}
else if($field->title == 'Address Line 1')
{
// str_replace doesn't work, as the above has already been done, replacing each $field->title.
}
// rest of code
}
And then I display it in a table using $title.
However, the issue is that obviously when one string is detected, they are all replaced, as each record gets replaced with the same string. How can I overcome/recode/reapproach this to make it work?