Solved

php string manipulation

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

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

How to remove superseded packages in windows w60 or w61 installation media (.wim) or online system to prevent unnecessary space. w60 means Windows Vista or Windows Server 2008. w61 means Windows 7 or Windows Server 2008 R2. There are various …
Having just graduated from college and entered the workforce, I don’t find myself always using the tools and programs I grew accustomed to over the past four years. However, there is one program I continually find myself reverting back to…R.   So …
This video teaches viewers about errors in exception handling.
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

911 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

24 Experts available now in Live!

Get 1:1 Help Now