preg_replace question

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • willl69

    preg_replace question

    Here is the code i have to read stings that are set out as such - {STRING}

    $pattern = '/{(\w+)}/';
    $replace = '$\1';
    $template = preg_replace($p attern, $replace, $template);

    This outputs $STRING

    Anybody know how i can get the $STRING to $string within the preg_replace.
    I have tried:
    $replace = '$'.strtolower( '\1');
    but it doenst work.

    Any help much appreciated.

    Will

  • Ewoud Dronkert

    #2
    Re: preg_replace question

    willl69 wrote:[color=blue]
    > Anybody know how i can get the $STRING to $string within the preg_replace.[/color]

    http://php.net/manual/en/function.preg-replace.php example 5.

    --
    E. Dronkert

    Comment

    Working...