开发者

function m(str) { stuff } Is returning error? help with logic please

开发者 https://www.devze.com 2023-03-14 12:14 出处:网络
A post by https://stackoverflow.com/users/18936/bobince on one of my old questions has the below code.

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); }
0

精彩评论

暂无评论...
验证码 换一张
取 消