You are here: Re: str_replace() external file « PHP Programming Language « IT news, forums, messages
Re: str_replace() external file

Posted by The Numerator on 07/28/06 23:12

The Numerator wrote:
> Miguel Cruz wrote:
> > "The Numerator" <alvin4jesus@gmail.com> wrote:
> > > I have this page (print.php). In that file, I want to to include a text
> > > file from "songs/breathe.txt", and replace all instances of "<b" with
> > > "<span" and "</b>" with "</span>". I know how I should use str_replace
> > > and I tried to do this:
> > >
> > > <?php
> > >
> > > $replace_a=str_replace("<span","<b",include("text/breathe.txt"));
> > > $replace_b=str_replace("</span>",</b>",$replace_a);
> > >
> > > ?>
> > >
> > > but it doesn't work.
> >
> > $replace_a
> > = str_replace('<span', '<b', file_get_contents('text/breathe.txt'));
> >
> > miguel
> > --
> > Photos from 40 countries on 5 continents: http://travel.u.nu
> > Latest photos: Malaysia; Thailand; Singapore; Spain; Morocco
> > Airports of the world: http://airport.u.nu
>
>
> sorry, this didn't work

actually, i was wrong...i got it to work...

<?php
$content=file_get_contents($txt);
$replace=str_replace("<b","<span",$content);
echo(str_replace("</b>","</span>",$replace));
?>

thx

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация