Search code examples
phpapc

using a variable in the key of APC


I want to do something like this:

apc_store('apc-$t', $something);

but when looking at the cache it shows "apc-$t". I really tried every possible combination with .'" and other things, but without success. Is this possible ?


Solution

  • PHP won't interpret variables if you use single quotes. You need to use:

    apc_store("apc-$t", $something);
    

    or:

    apc_store('apc-'.$t, $something);