SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Enthusiast
    Join Date
    Feb 2004
    Location
    Body
    Posts
    53
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Preg replace error

    Any idea why this line of code:
    $image['format'] = strtolower(preg_replace('/^.*?//', '', $image['mime']));

    Produces this error:
    Warning: preg_replace() [function.preg-replace]: Unknown modifier '/'

    Thanks for the help.

  2. #2
    @php.net Salathe's Avatar
    Join Date
    Dec 2004
    Location
    Edinburgh
    Posts
    1,398
    Mentioned
    65 Post(s)
    Tagged
    1 Thread(s)
    It looks like you want the pattern to match anything up to a forward slash. Since that is the pattern delimiter, you need to escape it or use a different delimiter.

    E.g. /^.*?\// or ~^.*?/~
    Salathe
    Software Developer and PHP Manual Author.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •