3 $s = strtolower('heLLo');
14 function apcOps($key, $val) {
15 apc_store($key, $val);
16 // need to fetch the value twice because under common
17 // config settings object are serialized on first store
18 // and APCObject (APCCollection) are created on second
20 var_dump(apc_fetch($key));
21 var_dump(apc_fetch($key));
24 echo "**** Object instance with simple properties\n";
28 echo "**** Vector containing object reference\n";
29 $c = Vector
{1, 2, $o};
31 echo "modify previous instance from APC\n";
32 $apcObj = apc_fetch('key');
36 var_dump('MUTATED', $apcObj);
37 var_dump(apc_fetch('key'));
39 echo "**** Vector containing non-refcounted values\n";
40 $c = Vector
{1, 'hello'};
42 echo "modify previous instance from APC\n";
43 $apcObj = apc_fetch('key');
47 var_dump('MUTATED', $apcObj);
48 var_dump(apc_fetch('key'));
50 echo "**** Vector containing simple values\n";
51 $c = Vector
{true, $s};
53 echo "modify previous instance from APC\n";
54 $apcObj = apc_fetch('key');
58 var_dump('MUTATED', $apcObj);
59 var_dump(apc_fetch('key'));
61 echo "**** Map containing non-refcounted values\n";
62 $m = Map
{'a' => 'b', 'c' => 'd'};
64 echo "modify previous instance from APC\n";
65 $apcObj = apc_fetch('key');
66 $apcObj['one'] = 'hi';
69 var_dump('MUTATED', $apcObj);
70 var_dump(apc_fetch('key'));
72 echo "**** Map containing itself\n";
73 $m = Map
{'a' => 'b', 'c' => $m};
75 echo "modify previous instance from APC\n";
76 $apcObj = apc_fetch('key');
77 $apcObj['one'] = 'hi';
80 var_dump('MUTATED', $apcObj);
81 var_dump(apc_fetch('key'));
83 echo "**** Map containing a vector\n";
84 $m = Map
{'a' => 'b', 'c' => $c};
86 echo "modify previous instance from APC\n";
87 $apcObj = apc_fetch('key');
88 $apcObj['one'] = 'hi';
91 var_dump('MUTATED', $apcObj);
92 var_dump(apc_fetch('key'));
94 echo "**** Immutable Vector instance\n";
95 $c = ImmVector
{1, 'hello'};
98 echo "**** Immutable Map instance\n";
99 $m = ImmMap
{'a' => 'b', 'c' => 'd'};
102 echo "**** Object instance containg itself\n";
107 echo "**** Object instance containg itself 2\n";
113 echo "**** Object instance containg itself 3\n";
120 echo "**** Object instance containg itself 4\n";
127 echo "**** Object instance containg itself 5\n";
134 echo "**** Object instance containg Vector instace with simple values\n";
140 $o->x
->f
[] = strtolower('heLLo');
143 echo "**** Object instance containg collections instaces\n";
148 $o->x
->f
['k1'] = 'hi';
149 $o->x
->f
['k2'] = Vector
{};
150 $o->x
->f
['k2'][] = 100;
151 $o->x
->f
['k2'][] = 'hello';
154 echo "**** Set instance\n";
155 $s = Set
{ 1, 'hi', 4, $s};
158 echo "**** Set instance with int-like strings\n";
159 $s = Set
{ 123, '123'};
162 echo "**** Make sure delete is ok\n";