note 127130 added to class.ds-set

From: Date: Tue, 24 May 2022 10:08:41 +0000
Subject: note 127130 added to class.ds-set
Groups: php.notes 
Request: Send a blank email to php-notes+get-218522@lists.php.net to get a copy of this message
One nice thing is the type-awarness. array_unique() lose values (whatever flag), while Ds\Set keep them. <?php $array = [true, false, null, '', 0, '0', 123, '123']; var_dump(array_unique($array)); var_dump(new \Ds\Set($array)); /* Gives : array(4) { [0]=> bool(true) [1]=> bool(false) [4]=> int(0) [6]=> int(123) } object(Ds\Set)#1 (8) { [0]=> bool(true) [1]=> bool(false) [2]=> NULL [3]=> string(0) "" [4]=> int(0) [5]=> string(1) "0" [6]=> int(123) [7]=> string(3) "123" } */ ---- Server IP: 45.112.84.4 Probable Submitter: 80.90.12.131 (proxied: 2a01:e0a:968:1840:a539:8138:275a:4564) ---- Manual Page -- https://php.net/manual/en/class.ds-set.php Edit -- https://main.php.net/note/edit/127130 Del: integrated -- https://main.php.net/note/delete/127130/integrated Del: useless -- https://main.php.net/note/delete/127130/useless Del: bad code -- https://main.php.net/note/delete/127130/bad+code Del: spam -- https://main.php.net/note/delete/127130/spam Del: non-english -- https://main.php.net/note/delete/127130/non-english Del: in docs -- https://main.php.net/note/delete/127130/in+docs Del: other reasons-- https://main.php.net/note/delete/127130 Reject -- https://main.php.net/note/reject/127130 Search -- https://main.php.net/manage/user-notes.php

« previous php.notes (#218522) next »