Solved

Remove slash from a string

Posted on 2006-11-28
1
1,031 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
ID: 18033890
if(strpos($str, '/')==1)
  $str=substr($str,2,strlen($str)-1)."/";
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Both Easy and Powerful How easy is PHP? http://lmgtfy.com?q=how+easy+is+php (http://lmgtfy.com?q=how+easy+is+php)  Very easy.  It has been described as "a programming language even my grandmother can use." How powerful is PHP?  http://en.wikiped…
Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

895 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

18 Experts available now in Live!

Get 1:1 Help Now