Is it possible to change a sub-string of an object element in the flow inside of a foreach loop? So what I try but it's not working.
$xml= '';
foreach ($objetcs as $object){
str_replace('searched','replacement', $object->link);
//then I would call a function to render my rss
$xml .=$object->renderRSS();
}
str_replace
will return a string or an array, it won't change original variable, so you should do $object->link = str_replace('searched','replacement', $object->link);
if $link
is public
Try:
$object->link = str_replace('searched','replacement', $object->link);
Try this:
$xml= '';
foreach ($objetcs as $object){
$object->link = str_replace('searched','replacement', $object->link);
//then I would call a function to render my rss
$xml .=$object->renderRSS();
}