FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » help to debug a simple php preg_replace
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
help to debug a simple php preg_replace [message #172056] Fri, 28 January 2011 17:40 Go to previous message
juliani(dot)moon(at)gmail(dot)co is currently offline  juliani(dot)moon(at)gmail(dot)co
Messages: 6
Registered: January 2011
Karma:
Junior Member
I have following php code to convert "<" to "&#60;" and "@" to "_at_",
etc. However it does not work (no effects - text are all printed as
they are) on command line test:

<?php
if (file_exists("infile")) {
$textline = file_get_contents("infile");
#$hyprtext = preg_replace('/</', '&#60;', $textline);
#$hyprtext = preg_replace('/>/', '&#62;', $textline);
$hyprtext = preg_replace('/@/', '_at_', $textline);
$hyprtext = preg_replace("/(http:\/\/[^\s]+)/", "<a href=\"$1\">$1</
a>", $textline);
print "$hyprtext";
}
?>

Could some sharp eyes help to see what's wrong?

Joe
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Shri Shraddha Astrology
Next Topic: Asynchronous FTP Upload
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Fri Sep 20 19:14:25 GMT 2024

Total time taken to generate the page: 0.06973 seconds