Lines Matching refs:map
2 Basic WeakMap behavior (as a map)
6 $map = new WeakMap;
7 var_dump(count($map));
14 $map[$obj] = $obj2;
15 var_dump(count($map));
16 var_dump($map);
17 var_dump(isset($map[$obj]));
18 var_dump(!empty($map[$obj]));
19 var_dump($map[$obj]);
21 $map[$obj] = 42;
22 var_dump($map);
23 var_dump(isset($map[$obj]));
24 var_dump(!empty($map[$obj]));
25 var_dump($map[$obj]);
27 $map[$obj] = false;
28 var_dump($map);
29 var_dump(isset($map[$obj]));
30 var_dump(!empty($map[$obj]));
31 var_dump($map[$obj]);
33 $map[$obj] = null;
34 var_dump($map);
35 var_dump(isset($map[$obj]));
36 var_dump(!empty($map[$obj]));
37 var_dump($map[$obj]);
39 unset($map[$obj]);
40 var_dump($map);
41 var_dump(isset($map[$obj]));
42 var_dump(!empty($map[$obj]));
44 var_dump($map[$obj]);
49 // It's okay to unset an object that's not in the map.
50 unset($map[new stdClass]);
53 $map[$obj] = [];
54 $map[$obj][] = 42;
55 $map[$obj2] = 41;
56 $map[$obj2]++;
57 var_dump($map);
60 var_dump($map->offsetSet($obj2, 43));
61 var_dump($map->offsetGet($obj2));
62 var_dump($map->offsetExists($obj2));
63 var_dump($map->count());
64 var_dump($map->offsetUnset($obj2));
65 var_dump($map->count());