Skip to content

Commit be0c157

Browse files
committed
More extensive docs for parameter access. See Issue #42.
1 parent 5dba91a commit be0c157

File tree

1 file changed

+26
-3
lines changed

1 file changed

+26
-3
lines changed

doc/usage_3.md

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,15 +109,38 @@ unset($vcard->FN);
109109
isset($vcard->FN);
110110
```
111111

112-
### Manipulating parameters
112+
### Working with parameters
113+
114+
To get access to a parameter, you can simply use array-access:
115+
116+
```php
117+
$type = $vcard->TEL['TYPE']:
118+
echo (string)$type;
119+
```
120+
121+
Parameters can also appear multiple times. To get to their values, just loop
122+
through them:
123+
124+
```php
125+
if ($param = $vcard->TEL['TYPE']) {
126+
foreach($param as $value) {
127+
echo $value, "\n";
128+
}
129+
}
130+
```
113131

114132
To change parameters for properties, you can use array-access syntax:
115133

116134
```php
117135
<?php
118136

119-
$tel = $vcard->FN;
120-
$tel['TYPE'] = ['WORK','FAX']:
137+
$vcard->TEL['TYPE'] = ['WORK','FAX']:
138+
```
139+
140+
Or when you're working with singular parameters:
141+
142+
```php
143+
$vcard->TEL['PREF'] = 1;
121144
```
122145

123146
### Parsing vCard or iCalendar

0 commit comments

Comments
 (0)