Posted By

nicolaspar on 12/26/06


Tagged


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite

vali29
willcodeforfood


PHP - Reemplazar contenido de tag A


 / Published in: PHP
 

  1. /*
  2. In
  3. $Link: URL completa
  4. $str: String que reemplazara al actual valor encerrado en <a></a>
  5. */
  6. function tuFuncion($link, $str){
  7. if( ! empty( $link ) )
  8. return ereg_replace(">([^>]+)</a>", ">".$str."</a>", $link);
  9. else
  10. return false;
  11. }
  12. $link = '<a href="http://www.dominio.com/talcosa" target="_blank">Este texto </a>';
  13. echo tuFuncion($link, "Por este texto");

Report this snippet  

You need to login to post a comment.