Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHP replace & > & not working

Tags:

replace

php

email

I'm having some trouble decoding & to & within a mail function:

This is the code:

$betreff = $_REQUEST["Betreff"];
$betreffUTF8 = "=?UTF-8?B?".base64_encode($betreff)."?=";     
$betreffFinal = str_replace('$amp;', '&', $betreffUTF8);

I'm pretty sure it should work like that, but for some reason it doesn't.

Any idea?

Update: Yes, the $amp; was just a typo.

like image 515
Andreas Avatar asked Jul 31 '26 02:07

Andreas


1 Answers

It's &, not $amp;.

$betreffFinal = str_replace('&', '&', $betreffUTF8);
like image 120
xdazz Avatar answered Aug 02 '26 16:08

xdazz