Re: running a function on an eregi-substring

From: Date: Mon, 19 May 2003 12:38:15 +0000
Subject: Re: running a function on an eregi-substring
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-148155@lists.php.net to get a copy of this message
"Michiel Van Heusden" <michiel@aemulatio.nl> wrote in message news:20030519105530.95251.qmail@pb1.pair.com... > i'm having trouble using eregi_replace in a script similar to the following > don't if this is possible at all but i'd like to know if this is possible, > how to fix it, any help? > > <? > > $content = "hello world"; > > function makebold ($string) { > return "<b>" . $string . "</b>"; > } > > $output = eregi_replace("hello", makebold(\\0), $content); > > echo $output; > > ?> > > You could try: <?php $content = "hello world"; $boldstart = "<b>"; $boldend = "</b>"; echo $boldstart . $content . $boldend; ?>

« previous php.general (#148155) next »