Te toco escribir el decode() pero al menos asi funciona:
    
Código PHP:
Ver original<?php
 
function my_htmlentities($s){
    return str_replace(array('<','>','\\','/'),array('__menor__','__mayor__','__slash__','__diagonal__'),$s); }
 
$foo = 'bla bla <b>Hello World!</b>';
 
?>
<a href="<?= 'http://localhost/pruebas/test-'.$foo_encoded; ?>">Enlace</a>