How do i strip the extension from a query result.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sybaris
    New Member
    • Nov 2006
    • 12

    How do i strip the extension from a query result.

    Hi,

    I am trying to strip the extension from the result of a query so i can then use what is left for something else.

    What i would like is if the result of the query is MOV123.avi i need to take away the .avi bit and replace it with .jpg, Is this possible please.
  • ronverdonk
    Recognized Expert Specialist
    • Jul 2006
    • 4259

    #2
    For this simple replacement you can use the str_replace() function of php:
    [php]str_replace('.a vi', '.jpg', $string);[/php]
    For more complicated replacements you could also use a regular expression replace such as [php]preg_replace($p attern, $replacement, $string);[/php]Ronald :cool:

    Comment

    • sybaris
      New Member
      • Nov 2006
      • 12

      #3
      Brilliant thank you very much :) Oh and happy new year

      Comment

      Working...