How to use a <?php echo urlencode($term);?> tag inside a php script


I am trying to include a tag that works well all over the webpage but I need to figure out how to make it function inside a existing php script that is in the same page. Below is the example I am looking to make work. This way the rss feed will track the keywords that was used in the search automatically.


// output RSS feed to HTML

output_rss_feed('<?php echo urlencode($term);?>', 6, true, true, 200);


Source: Ask PHP