PHP apc_store() about "cache a variable"

The PHP manual says

bool apc_store ( string $key , mixed $var [, int $ttl = 0 ] )

about the $var

var

The variable to store

But there is no mention anywhere that $var may actually be a value, a literal. So

$e = 2.71828;
apc_store("mykey", $e);

works, but what about setting the value directly

apc_store("mykey", 2.71828);

does it work equally? (that would make this manual a bad manual)
I tried it and it seems to work. But when it comes to the sensitive APC (which is still, while discontinued, one of the best options to cache data in shared memory), I just want to be sure! For instance apc_store may actually want a variable reference (equivalent of &$x) and setting a value may or may not work (?)


Source: syntax

Leave a Reply