Hey there. I have this image hosting and watermarking script. When I uploaded it to my server it get this error: Fatal error: Call to undefined function: str_ireplace() in /home/content/C/y/b/CyberSite/html/skumbucket/img/libs/setup.php on line 48 Code (markup): If I send somebody the file that's being messed up can somebody fix it, or tell me what to do?
str_ireplace() is a PHP5 function only. So your script was written for PHP 5 but the server is (smartly) running a 4 version. You can replace the function calls with eregi_replace
Or if your server plans to upgrade to PHP5 shortly you could just stick in at the bottom of your page function str_ireplace($string_pattern, $string_replacement, $string_string){ return eregi_replace($string_pattern, $string_replacement, $string_string); } and when you upgrade just remove the code.
lol Its probably something to do with the format of the parameters. It wouldn't take a PHP genius or much research time to figure out which way its supposed to be structured. eregi_replace has a slightly different method of taking in the parameters as it uses patterns and not strings. So the adjusted function would be function str_ireplace($string_pattern, $string_replacement, $string_string){ $pattern = "(".$string_pattern.")"; $replacement = $string_replacement; $string = $string_string; return eregi_replace($pattern, $string_replacement, $string); } I have no idea what your code looks like or what you're trying to do. Now go do some of your own programming and don't go on about how someones solution gave a bunch of errors when you hadn't even tried sorting it yourself.
Just because you haven't seen his code and he obviously does not have the ability to research and correct his own problem does't mean you can't do the work for him (free of charge). Further, you should always be subject to the cries of "it doesn't work" when offering good coding practice of encapsulating. I hope you didn't miss the sarcasm... Bobby
But why should that stop you from posting the code on your page. That's all anyone was asking for to try and help solve your problem. Anyway, I've tested the latter solution and I know that it works so that should help you out for now until you get a server upgrade. lol Bobby. Sorry for leaving out the commenting as well.