Solved

php string manipulation

Posted on 2014-01-08
2
382 Views
Last Modified: 2014-01-08
I need help with a php function to maniuplate a string as such:

Replace all "." with "//"
Replace the "@" symbol with "/"
Reverse the text

input: myemail@site.com.au
output: ua//moc//etis/liameym
0
Comment
Question by:joomla
2 Comments
 
LVL 34

Accepted Solution

by:
Dan Craciun earned 200 total points
ID: 39767201
function <name-here>($input) {
  $needle = array(".", "@");
  $repl = array("//", "/");
  return strrev(str_replace($needle, $repl, $input));
}

HTH,
Dan
0
 

Author Closing Comment

by:joomla
ID: 39767233
thanks for the script.... it will help with lots of other requirements too.
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

There is an easy way, in .NET, to centralize the treatment of all unexpected errors. First of all, instead of launching the application directly in a Form, you need first to write a Sub called Main, in a module. Then, set the Startup Object to th…
This article discusses four methods for overlaying images in a container on a web page
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.

747 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

9 Experts available now in Live!

Get 1:1 Help Now