Hasan Basri - 2020-09-26 17:31:20
Why repeat to other contact below ?
How to set ?
code like this
$oVCard = new VCard();
// just create new contact
$oContact = new VCardContact();
$oContact->setName('Basri', 'Hasan');
$oContact->addPhone('62822*****2319', VCard::CELL, true);
$oVCard->addContact($oContact);
// change name and portrait
$oContact->setName('Fredi', 'Tegar');
$oContact->addPhone('62822*****2322', VCard::HOME, true);
$oContact->addPhone('62822*****3255', VCard::HOME, true);
$oVCard->addContact($oContact);
// change name again and add some additional info....
$oContact->setName('Andri', 'Sardi');
$oContact->addPhone('62822*****2325', VCard::HOME, true);
$oVCard->addContact($oContact);
// and write to file
$oVCard->write('test.vcf', false);
here the result
Filename: test.vcf
BEGIN:VCARD
VERSION:3.0
N:Basri;Hasan;;;
FN:Hasan Basri
ORG:;
X-MS-OL-DEFAULT-POSTAL-ADDRESS:1
TEL;TYPE=CELL,PREF:62822*****2319
END:VCARD
BEGIN:VCARD
VERSION:3.0
N:Fredi;Tegar;;;
FN:Tegar Fredi
ORG:;
X-MS-OL-DEFAULT-POSTAL-ADDRESS:1
TEL;TYPE=CELL:62822*****2319
TEL;TYPE=HOME:62822*****2322
TEL;TYPE=HOME,PREF:62822*****23255
END:VCARD
BEGIN:VCARD
VERSION:3.0
N:Andri;Sardi;;;
FN:Sardi Andri
ORG:;
X-MS-OL-DEFAULT-POSTAL-ADDRESS:1
TEL;TYPE=CELL:62822*****2319
TEL;TYPE=HOME:62822*****2322
TEL;TYPE=HOME:62822*****23255
TEL;TYPE=HOME,PREF:62822*****2325
END:VCARD