Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

php string manipulation

Posted on 2014-01-08
2
Medium Priority
?
423 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 35

Accepted Solution

by:
Dan Craciun earned 800 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

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.

Question has a verified solution.

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

Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
There are times when I have encountered the need to decompress a response from a PHP request. This is how it's done, but you must have control of the request and you can set the Accept-Encoding header.
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.
Suggested Courses
Course of the Month11 days, 19 hours left to enroll

916 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