Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1068
  • Last Modified:

Remove slash from a string

I have a php string. Sometimes it contains a slash in the beginning.

How do I :
- Check if the start of string is space followed by slash or just slash
- If so remove the slash from beginning and move it to the end

String is stored in variable called $header
0
rohgan
Asked:
rohgan
1 Solution
 
HuyBDCommented:
if(strpos($str, '/')==1)
  $str=substr($str,2,strlen($str)-1)."/";
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now