Jump to content

Beginner: str_replace and include


mac_gabe

Recommended Posts

Apologies, I'm a complete beginner, so don't even know what to search for, I'm sure this is really elementary level.

 

I've got html text on a second page which I want to "include" in the main php web page and do a "string replace" on at the same time.

 

I can do the "include" OK on its own, but can't get the "string replace" to work at the same time, it just returns the unaltered text.

 

I then want to do something quite a bit more complicated but need to get over this hurdle first. Many thanks for any help.

 

<?php
$sidebar = 'index_files/sidebar-content2.html';
echo str_replace("Auks", "Penguins", include $sidebar);
?>

Link to comment
https://forums.phpfreaks.com/topic/218098-beginner-str_replace-and-include/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.