djones Posted January 30, 2010 Share Posted January 30, 2010 I can't seem to get my mind on this correctly. I need $page_content to go through each function, but It seems to either replace itself or duplicate itself. $filter is an array of function names $count = count($filter); if($count > 0){ foreach($filter as &$func){ $page_content = $func($content); // where the function returns the content. see sample functions below // $page_content .= $func($content); // not working either } } function replace_text($content){ $content = str_ireplace('test', 'WORKING', $content); return $content; } function replace_text_again($content){ $content = str_ireplace('page', 'THIS AN EXAMPLE', $content); return $content; } echo $page_content; Link to comment https://forums.phpfreaks.com/topic/190328-need-help-using-foreach/ Share on other sites More sharing options...
djones Posted January 30, 2010 Author Share Posted January 30, 2010 I got it. I needed to change $content to $page_content. Link to comment https://forums.phpfreaks.com/topic/190328-need-help-using-foreach/#findComment-1004114 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.