Solved

Remove slash from a string

Posted on 2006-11-28
1
1,028 Views
Last Modified: 2012-08-13
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
Comment
Question by:rohgan
1 Comment
 
LVL 17

Accepted Solution

by:
HuyBD earned 500 total points
Comment Utility
if(strpos($str, '/')==1)
  $str=substr($str,2,strlen($str)-1)."/";
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
Part of the Global Positioning System A geocode (https://developers.google.com/maps/documentation/geocoding/) is the major subset of a GPS coordinate (http://en.wikipedia.org/wiki/Global_Positioning_System), the other parts being the altitude and t…
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

7 Experts available now in Live!

Get 1:1 Help Now