Solved

php string manipulation

Posted on 2014-01-08
2
393 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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Suggested Solutions

This article will show, step by step, how to integrate R code into a R Sweave document
The purpose of this article is to demonstrate how we can use conditional statements using Python.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.
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 …

786 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