function m(str) { stuff } Is returning error? help with logic please
A post by https://stackoverflow.com/users/18936/bobince on one of my old questions has the below code.
Except i cannot seem to work out how to implement this method of creating functions to streamline the process of re-using some common php commands.
But it wont work?
I have this:
function m(str) { return "'".mysql_real_escape_string(str)."'"; }
function h(str) { echo htmlspecialchars(str); }
function u(str) { echo rawurlencode(str); }
I get this error?
Parse error: syntax error, unexpected ')', expecting '&' or T_VA开发者_开发技巧RIABLE in /home/dev/public_html/tpm/templates/tpm/index.php on line 79
Any help would be appreciated
In PHP variable names begin with a $
dollar sign.
You should have written $str
instead of str
:
function h($str) { echo htmlspecialchars($str); }
精彩评论