My code is:
$key1='qwerty199@234.45';
$key2='qwerty199@234.45';
$key3='qwerty199@234.45';
$item=array(
'$key1' => 'casfid=qwert12345',
'$key2' => '2=1234567890',
'$key3' => 'product name=test ivr'
);
$static_client->setMulti($item,time() + 300);
$null = null;
$keys = array_keys($item);
$got = $static_client->getMulti($keys, $null, Memcached::GET_PRESERVE_ORDER);
foreach ($got as $k => $v) {
echo "$k $v
";
However, output is :
$key1 casfid=qwert12345
$key2 2=1234567890
$key3 product name=test ivr
Is there any way through which I can get desired values of '$key1','$key2','$key3' defined above.
Thanks
Remove the quotation marks from the key variables when defining the array, instead of doing this:
$item=array(
'$key1' => 'casfid=qwert12345',
'$key2' => '2=1234567890',
'$key3' => 'product name=test ivr'
);
Do this:
$item=array(
$key1 => 'casfid=qwert12345',
$key2 => '2=1234567890',
$key3 => 'product name=test ivr'
);
Edit: To allow multiple values on each key, each key will have to contain an array:
$item = array();
$item[$key1][] = 'casfid=qwert12345';
$item[$key2][] = '2=1234567890';
$item[$key3][] = 'product name=test ivr';
I'll leave it up to you to discover the correct way to read from this or add more data.