note 83361 added to function.empty
| From: | tom at tomwardrop dot com | Date: | Thu, 22 May 2008 12:01:29 +0000 |
| Subject: | note 83361 added to function.empty | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-139610@lists.php.net to get a copy of this message | ||
In reply to "admin at ninthcircuit dot info",
Using str_replace is unnecessary. I would encourage the use of trim which would most likely be
faster (haven't tested) and easier. Trim also takes care of other white space like line breaks
and tabs. Actually, in most of the applications I code, I use a multi-dimensional array map function
with trim on the Super Globals such as $_POST, $_GET and $_COOKIE as so far, there hasn't been
an instance where I would want any user input to begin or end with whitespace. The good thing about
doing this is that you never have to worry about 'trimming' your input which makes your
code easier and more reliable (incase you forget to trim some input).
----
Server IP: 117.104.160.194
Probable Submitter: 203.171.98.49 (proxied: 203.171.98.49)
----
Manual Page -- http://www.php.net/manual/en/function.empty.php
Edit -- https://master.php.net/note/edit/83361
Del: integrated -- https://master.php.net/note/delete/83361/integrated
Del: useless -- https://master.php.net/note/delete/83361/useless
Del: bad code -- https://master.php.net/note/delete/83361/bad+code
Del: spam -- https://master.php.net/note/delete/83361/spam
Del: non-english -- https://master.php.net/note/delete/83361/non-english
Del: in docs -- https://master.php.net/note/delete/83361/in+docs
Del: other reasons-- https://master.php.net/note/delete/83361
Reject -- https://master.php.net/note/reject/83361
Search -- https://master.php.net/manage/user-notes.php