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.
join()
functionThis function joins the values together by making them a string.
string public Ds\Set::join ([ string $glue ] )
The function takes in one optional parameter, which is a string to separate each value.
This function returns all values joined together as a string.
The following example shows the join()
function in action.
<?php$set = new \Ds\Set(["E", "D", "U", "C", "A", "T", "I", "V", "E"]);// join() functionvar_dump($set->join());?>
string(9) "EDUCATIVE"