Hello,

I need to remove dashes from beginning and end of a string.

I use:
$string = preg_replace("/-+/", " ", $string);
to remove multiple. When it's done I need to remove dashes from beginning and end of a string.

Can somebody help me?
Thank you.

    $string = trim($string, '-');
    

      Thank you NogDog! Great!
      I knew trim function, but I was thinking it only removes whitespaces.

        Write a Reply...