What is the Ds\Set join() function in PHP?

PHP functions

PHP has more than a thousand inbuilt functions and enables its developers to create their own functions as well. Functions are considered one of the extraordinary strengths of PHP; they are a structure of code that can be used repetitively. They need to be called in order to achieve their specific task.

The Ds\Set join() function

This function joins the values together by making them a string.

string public Ds\Set::join ([ string $glue ] )

Parameters

The function takes in one optional parameter, which is a string to separate each value.

Return value

This function returns all values joined together as a string.

g E E join join E->join Educative Educative join->Educative d d d->join u u u->join c c c->join a a a->join t t t->join i i i->join v v v->join e e e->join

Code

The following example shows the join() function in action.

<?php
$set = new \Ds\Set(["E", "D", "U", "C", "A", "T", "I", "V", "E"]);
// join() function
var_dump($set->join());
?>

Output

string(9) "EDUCATIVE"

Free Resources