note 108334 added to function.shm-get-var
| From: | shane.hartergmail.com | Date: | Wed, 18 Apr 2012 01:43:29 +0000 |
| Subject: | note 108334 added to function.shm-get-var | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-187214@lists.php.net to get a copy of this message | ||
In response to the post below mine -- the Boolean wrapper class.
I personally think shm_get_var should return null if a variable is not set, but it's not like
this is a real problem.
If you're writing booleans, and if shm_get_var returns an ambiguous "false", just
call shm_has_var.
No need for crazy slow class hierarchies.
$var = shm_get_var($resource, "CouldBeFalseVar");
if ($var === false && !shm_has_var($resource, "CouldBeFalseVar")) {
$var = null;
}
Optimal.
For all non-false variables, one SHM op is done. For fale variables, 2 are done.
Remember, SHM is a system-level resource. It doesn't "speak php" per se. When you
store a non-scalar type (like an object) in there, it's going to be implicitely serialized.
(e.g. Awful performance)
Class wrapper of native types are pretty much always a bad idea.
----
Server IP: 69.147.83.197
Probable Submitter: 76.14.86.166
----
Manual Page -- http://www.php.net/manual/en/function.shm-get-var.php
Edit -- https://master.php.net/note/edit/108334
Del: integrated -- https://master.php.net/note/delete/108334/integrated
Del: useless -- https://master.php.net/note/delete/108334/useless
Del: bad code -- https://master.php.net/note/delete/108334/bad+code
Del: spam -- https://master.php.net/note/delete/108334/spam
Del: non-english -- https://master.php.net/note/delete/108334/non-english
Del: in docs -- https://master.php.net/note/delete/108334/in+docs
Del: other reasons-- https://master.php.net/note/delete/108334
Reject -- https://master.php.net/note/reject/108334
Search -- https://master.php.net/manage/user-notes.php