Re: ereg_replace
| From: | Rasmus Lerdorf | Date: | Mon, 28 Aug 2000 08:58:04 +0000 |
| Subject: | Re: ereg_replace | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-13910@lists.php.net to get a copy of this message | ||
> I was wondering if anyone knew what was wrong with my code? This is my first
> time using ereg_replace and I'm not sure what I'm doing wrong..
>
> $fp = fopen("data/items.js","r");
> $fg = fgets($fp,40000);
> fclose($fp);
>
> ereg_replace($itemname,$username,$fg);
>
> $fp2 = fopen("data/items.js","w");
> $fg2 = fputs($fp2,$fg);
> fclose($fp2);
>
> The error I get when I run this is:
>
> Warning: REG_EMPTY:xempty (sub)expression in c:\pages\ss\holditem.php on
> line 16
You don't show what is in either $itemname, nor $username. Your
fopen/fgets stuff does not appear to have anything to do with your regex
problem. ereg_replace() also returns the modified string and you are not
assigning this returned string to anything.
-Rasmus