heldenbrau Posted August 28, 2009 Share Posted August 28, 2009 function headingsafe($hin) { $S1= array('£',"'",'?','>','<','"',':',';'); $S2= array('£',''','?','>','<','"',':',';'); return str_replace($S1, $S2, $hin); This is the first time I have tried to use a function and of course there is an error. Is there something wrong with my function? Quote Link to comment Share on other sites More sharing options...
ignace Posted August 28, 2009 Share Posted August 28, 2009 This is not the code in which this error occurs. You are passing somewhere a function name where it expects the name of the function as a string, you prolly called it directly without the parenthesis. Quote Link to comment Share on other sites More sharing options...
Maq Posted August 28, 2009 Share Posted August 28, 2009 There is no terminating '}', unless you didn't copy it. Quote Link to comment Share on other sites More sharing options...
PFMaBiSmAd Posted August 28, 2009 Share Posted August 28, 2009 And posting the line of code that the error message indicates the error is at would help. Quote Link to comment Share on other sites More sharing options...
heldenbrau Posted August 28, 2009 Author Share Posted August 28, 2009 The } was on the next line, I missed it out of the C&P The line number is 17 where the function is called. But I didn't realise that until I looked again. I called it like this: $headline = headingsafe($_POST('headline')); Quote Link to comment Share on other sites More sharing options...
Alex Posted August 28, 2009 Share Posted August 28, 2009 $headline = headingsafe($_POST['headline']); Quote Link to comment Share on other sites More sharing options...
heldenbrau Posted August 28, 2009 Author Share Posted August 28, 2009 :o :'( Not again, every time it is something like this. At least I am learning because every time I don't spot the missing bracket or semicolon I end up reading 10 pages of my php book trying to find what I have done wrong. Thanks for the help. Quote Link to comment Share on other sites More sharing options...
Maq Posted August 28, 2009 Share Posted August 28, 2009 Learning from mistakes is a major part of programming. I bet you won't make the same mistake again, or if you do, you will be able to recognize it right away. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.