PHP | Ds\Set __construct() Function Last Updated : 16 Aug, 2019 Summarize Comments Improve Suggest changes Share Like Article Like Report The Ds\Set::__construct() function is an inbuilt function in PHP which is used to create new instance of set. Syntax: Ds\Set::__construct( $values ) Parameters: This function accepts single parameter $values which holds the traversable object or array to use initial values. Below programs illustrate the Ds\Set::__construct() function in PHP: Program 1: php <?php // Declare a new set $set = new \Ds\Set(); print_r($set); // Declare a new set $set = new \Ds\Set(['G', 'E', 'K', 'S']); print_r($set); ?> Output: Ds\Set Object ( ) Ds\Set Object ( [0] => G [1] => E [2] => K [3] => S ) Program 2: php <?php // Declare a new set $set = new \Ds\Set([2, 3, 6, 7, 8]); var_dump($set); // Declare a new set $set = new \Ds\Set([2, 3, 5, 8, 9, 10]); var_dump($set); ?> Output: object(Ds\Set)#1 (5) { [0]=> int(2) [1]=> int(3) [2]=> int(6) [3]=> int(7) [4]=> int(8) } object(Ds\Set)#2 (6) { [0]=> int(2) [1]=> int(3) [2]=> int(5) [3]=> int(8) [4]=> int(9) [5]=> int(10) } Reference: https://www.php.net/manual/en/ds-set.construct.php Comment More infoAdvertise with us Next Article PHP | Ds\Set __construct() Function R R_Raj Follow Improve Article Tags : Web Technologies PHP PHP-function PHP-ds_set Similar Reads PHP | DsSet __construct() Function The Ds\Set::__construct() function is an inbuilt function in PHP which is used to create new instance of set. Syntax: Ds\Set::__construct( $values ) Parameters: This function accepts single parameter $values which holds the traversable object or array to use initial values. Below programs illustrate 1 min read PHP | DsPair __construct() Function The Ds\Pair::__construct() function is an inbuilt function in PHP which is used to create a new instance. Syntax: public Ds\Pair::__construct( $key, $value ) Parameters: This function accepts two parameters as mentioned above and described below: $key: This parameter holds the key of the pair elemen 2 min read PHP | DsDeque __construct() Function The Ds\Deque::__construct() function is an inbuilt function in PHP which is used to create a new instance. Syntax: Ds\Deque::__construct( $values ) Parameters: This function accepts single parameter $values which holds the traversable object or array to use initial values. Below programs illustrate 2 min read PHP | DsStack __construct() Function The Ds\Stack::__construct() function is an inbuilt function in PHP which is used to create a new instance of stack. Syntax: public Ds\Stack::__construct( $values ) Parameters: This function accepts single parameter $values which holds the traversable object or array to use initial values. Below prog 1 min read PHP | DsVector __construct() Function The Ds\Vector::__construct() function is an inbuilt function in PHP which is used to creates a new instance. Syntax: public Ds\Vector::__construct( $values ) Parameters: This function accepts single parameter $values which holds the traversable object or array to use initial values. Below programs i 1 min read Like