• PHP Video Tutorials

PHP - Ds Set join() Function



Ds\Set::join() function can join all values together as a string.

Syntax

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

Ds\Set::join() function can join all values together as a string by using an optional separator between each value.

Ds\Set::join() function can return all values of a set joined together as a string.

Example 1

<?php
   $set = new \Ds\Set(["I", "N", "D", "I", "A", 1, 2, 3, 4]);  
   var_dump($set->join());  
?> 

Example 2

<?php  
   $set = new \Ds\Set(["I", "N", "D", "I", "A", 1, 2, 3, 4]);  
   var_dump($set->join(", "));  
  
   $set = new \Ds\Set([10, 20, 30, "T", "P"]);  
   var_dump($set->join("|"));   
?> 
php_function_reference.htm
Advertisements