PHP-gurus: I need your help!

Out of context: Reply #11

  • Started
  • Last post
  • 22 Responses
  • mike0

    In the file i sent I extracted the file extension and then replaced it later... you could add several extensions in there for valid file types if you wanted to... but having the extension makes it simple to replace... your file naming convention is going to dictate what you need to do in order to strip the filename to its base name.

    you can also assign two arrays, each with a set of regular expressions for replacement conditions... then call:

    $sResult = preg_replace ($aBefore, $aAfter, $sArg);

    $sArg being the value you want to search and replace on, $aBefore being the array of regex matches and $aAfter being the replacement for theose key-mapped matches. the result gets assigned to $sResult.

    is that confusing as hell?

View thread