Acheron Posted June 25, 2004 Posted June 25, 2004 I know general questions aren't often welcome or answered here but it doesn't hurt to try. :) What would be the proper function and syntax to replace everything between the first X and the last Y with Z? For example: oneXtwoYthreeYfour would become (hopefully) oneXZYfour TIA if anyone can help. :)
Acheron Posted June 25, 2004 Author Posted June 25, 2004 Well, I was able to do this but it's not quite what I wanted as it simply replaces everything after and including the "@" substr($reviews['customers_email'], 0, strlen($reviews['customers_email'])-strlen (strstr ($reviews['customers_email'],"@"))) So "[email protected]" becomes "john" instead of "john@***.com" which is what I was shooting for.
♥ecartz Posted June 26, 2004 Posted June 26, 2004 Why not $at_sign = strpos($reviews['customers_email'], '@'); $last_dot = strrpos($reviews['customers_email'], '.'); $obfuscated_email = substr($reviews['customers_email'], 0, $at_sign+1) . '***' . substr($reviews['customers_email'], $last_dot); Hth, Matt Always back up before making changes.
Acheron Posted June 26, 2004 Author Posted June 26, 2004 Matt, Because I couldn't quite get it right. hehe Thanks, will give that a go. Really appreciate the response. :)
Recommended Posts
Archived
This topic is now archived and is closed to further replies.