Re: eregi_replace returns only lowercase



Bob wrote:
Hi,

Maybe this problem has already been mentionned, but I am new to this group, so here we go.

$string = "This is for ABC only"

$new = (eregi_replace('ABC','<b>ABC</b>',$string));

print $new geeft nu This is for <b>abc</b> only
where I would like to see 'abc' in uppercase. I have searched the internet for the solution, consulted several PHP books, but can not find the solution. Can anyone help? Thanks.

Bob


A regex is way overkill in this case. Just concatenate <b> and </b> before and after your user input, i.e. (in another post you indicate this is user input):

$new = "<br>{$POST['user_field']}.<br>";

Or, if you prefer,

$new = '<br>' . $POST['user_field'] . '<br>';

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@xxxxxxxxxxxxx
==================

.



Relevant Pages