preg_replace question...

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Wolf_22
Forum Contributor
Posts: 159
Joined: Fri Dec 26, 2008 9:43 pm

preg_replace question...

Post by Wolf_22 »

Here's the code:

Code: Select all

<?php
    $exp = "/[0-9]{9}/";
    $rep = '__________';
    $file = file_get_contents('names.txt');
    $final = preg_replace($exp,$rep,$file);
    print_r($final);
?>
For the most part, I THINK it's working but the email addresses won't show at the end due to something (not being escaped?).

I was wondering if someone could explain why they're hidden? It's driving me bonkers. :)

Edit: Sorry, I'm awake now and realized how more information could be used (thank God for coffee). The "names.txt" has email addresses in it and in Firefox, the email addresses are hidden from the page. If "View Source" is done, they're there. What's up with this? Is this an issue with Firefox / browser-in-general?
Wolf_22
Forum Contributor
Posts: 159
Joined: Fri Dec 26, 2008 9:43 pm

Re: preg_replace question...

Post by Wolf_22 »

Okay, so I guess I'm an idiot. :) I simply did a preg_replace to remove both angle brackets on each end of the e-mail address(es). Doing so caused Firefox to stop recognizing them--which exposed them for the end-user. That's a first for me. :banghead:
Post Reply