Nate,
OK here goes...
This code is from a conent management system. The $content is filled with text and markup tags entered by the user and stored to a database. When a user hits that page the script converts $content into renderable HTML that is passed to the browser. The convert $content script is a series of lines such as the following:
$content = eregi_replace("[BOLD]","<B>",$content);
$content = eregi_replace("[ENDBOLD]","</B>",$content);
$content = eregi_replace("[ITALICS]","<I>",$content);
$content = eregi_replace("[ENDITALICS]","</I>",$content);
To handle pictures I have a script, show_image.php that, given a querystring argument (eg. show_image.php?id=33), will find the image charactersitics for that record id and spit out some HTML including a url to that image in my directory system.
So back to the code in question:
$content = eregi_replace("[PIC=([-_./a-zA-Z0-9!&%#@?,'=:~]+)]",(implode ('', @file(\"\1"))),$content);
A db record for $content will be something literally like:
[PIC=http://172.31.1.50/extranet_dev/dotwidgit/show_image.php?id=80]
What I want the eregi_replace to do is in one fell swoop, replace "[PIC=http://172.31.1.50/extranet_dev/dotwidgit/show_image.php?id=80]" with the html that would be out put if I went to that url. The problem I seem to be having is getting the string pattern into the string replacement.
I usually get the error "Bad arguments to implode()"
I hope this makes sense.
many thanks,
mike