Jump to content


[PHP]Nestsed function


1 reply to this topic

#1 Slightly Wonky Robob

    Not a Wonky Gent.

  • Administrator
  • 9333 posts

Posted 26 June 2008 - 21:51

I'm just messing around with preg_replace again, and I'm wondering... Is it possible to use a function as the replace parameter?

e.g.
$str = preg_replace ("/\[(.*?)\]/is", tagType("$1") , $str);


This of course doesn't work, but you should hopefully get the idea of what I'm trying to do. My current attempts either use "$1 as a string, rather than a variable, output the function name or just give errors.

Ideas?

Edited by Bob, 26 June 2008 - 21:52.

Posted Image
F O R T H E N S
Posted Image

#2 CodeCat

    It's a trap!

  • Gold Member
  • 6111 posts

Posted 26 June 2008 - 22:39

http://nl.php.net/manual/en/function.preg-...ce-callback.php :P
CodeCat

Posted Image
Posted Image

Go dtiomsaítear do chód gan earráidí, is go gcríochnaítear do chláir go réidh. -Old Irish proverb



1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users