note 95173 deleted from function.array-unique by cmb

From: Date: Mon, 12 Nov 2018 14:46:37 +0000
Subject: note 95173 deleted from function.array-unique by cmb
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-209680@lists.php.net to get a copy of this message
Note Submitter: Youssef Omar ---- This is how to merge 2 comma separated lists with unique value only. <?php $list1 = "4444, 5555, 6666"; $list2 = "4444, 5555, 7777"; // combine both lists with unique values only $list3 = implode("," , array_unique(array_merge(explode(",",$list1),explode(",", $list2)))); echo $list3; ?> The result is: 4444,5555,6666,7777

« previous php.notes (#209680) next »