Skip to content
geeksforgeeks
  • Courses
    • DSA to Development
    • Get IBM Certification
    • Newly Launched!
      • Master Django Framework
      • Become AWS Certified
    • For Working Professionals
      • Interview 101: DSA & System Design
      • Data Science Training Program
      • JAVA Backend Development (Live)
      • DevOps Engineering (LIVE)
      • Data Structures & Algorithms in Python
    • For Students
      • Placement Preparation Course
      • Data Science (Live)
      • Data Structure & Algorithm-Self Paced (C++/JAVA)
      • Master Competitive Programming (Live)
      • Full Stack Development with React & Node JS (Live)
    • Full Stack Development
    • Data Science Program
    • All Courses
  • Tutorials
    • Data Structures & Algorithms
    • ML & Data Science
    • Interview Corner
    • Programming Languages
    • Web Development
    • CS Subjects
    • DevOps And Linux
    • School Learning
  • Practice
    • Build your AI Agent
    • GfG 160
    • Problem of the Day
    • Practice Coding Problems
    • GfG SDE Sheet
  • Contests
    • Accenture Hackathon (Ending Soon!)
    • GfG Weekly [Rated Contest]
    • Job-A-Thon Hiring Challenge
    • All Contests and Events
  • PHP Tutorial
  • PHP Exercises
  • PHP Array
  • PHP String
  • PHP Calendar
  • PHP Filesystem
  • PHP Math
  • PHP Programs
  • PHP Array Programs
  • PHP String Programs
  • PHP Interview Questions
  • PHP GMP
  • PHP IntlChar
  • PHP Image Processing
  • PHP DsSet
  • PHP DsMap
  • PHP Formatter
  • Web Technology
Open In App
Next Article:
PHP | DsDeque join() Function
Next article icon

PHP | Ds\Set join() Function

Last Updated : 16 Aug, 2019
Comments
Improve
Suggest changes
Like Article
Like
Report
The Ds\Set::join() function is an inbuilt function in PHP which is used to join all values as string. Syntax:
string public Ds\Set::join ([ string $glue ] )  
Parameters: This function accepts single parameter $glue which is optional. It is used to separate the set element. Return Value: This function returns a string. Below programs illustrate the Ds\Set::join() function in PHP: Program 1: php
<?php   // Create new set $set = new \Ds\Set(["G", "E", "E",                  "K", "S", 1, 2, 3, 4]);   // Use join() function and  // display the string  var_dump($set->join());   ?>  
Output:
  string(8) "GEKS1234"  
Program 2: php
<?php   // Create new set $set = new \Ds\Set(["G", "E", "E",                  "K", "S", 1, 2, 3, 4]);   // Use join() function and  // display the string separated  // with comma  var_dump($set->join(", "));   // Create new set $set = new \Ds\Set([1, 2, 3, "g", "e"]);   // Use join() function  var_dump($set->join("|"));   ?>  
Output:
  string(22) "G, E, K, S, 1, 2, 3, 4"  string(9) "1|2|3|g|e"  
Reference: https://www.php.net/manual/en/ds-set.join.php

Next Article
PHP | DsDeque join() Function

R

R_Raj
Improve
Article Tags :
  • Web Technologies
  • PHP
  • PHP-function
  • PHP-ds_set

Similar Reads

  • PHP | DsSet join() Function
    The Ds\Set::join() function is an inbuilt function in PHP which is used to join all values as string. Syntax: string public Ds\Set::join ([ string $glue ] ) Parameters: This function accepts single parameter $glue which is optional. It is used to separate the set element. Return Value: This function
    1 min read
  • PHP | DsDeque join() Function
    The Ds\Deque::join() function is an inbuilt function in PHP which is used to join all values in the Deque as a string. The separator can also be used to join the elements. Syntax: public Ds\Deque::join( $glue ) : string Parameters: This function accepts single parameter $glue which holds the separat
    2 min read
  • PHP | DsVector join() Function
    The Ds\Vector::join() function is an inbuilt function in PHP which is used to join all the elements of vector as a string using the separator provided as the argument. Syntax: string public Ds\Vector::join( $glue ) Parameters: This function accepts a single parameter $glue which is used to hold the
    1 min read
  • PHP | DsDeque set() Function
    The Ds\Deque::set() function is an inbuilt function in PHP which is used to set the value at the given index in the Deque. Syntax: public Ds\Deque::set( $index, $value ) : void Parameters: This function accept two parameters as mentioned above and described below: index: This parameter holds the ind
    2 min read
  • PHP | DsVector set() Function
    The Ds\Vector::set() function is an inbuilt function in PHP which is used to set the value in the vector at the given index. Syntax: void public Ds\Vector::set( $index, $value ) Parameters: This function accepts two parameters as mentioned above and described below: $index: This parameter holds the
    2 min read
  • PHP | DsSequence join() Function
    The Ds\Sequence::join() function is an inbuilt function in PHP which is used to join all values as string. Syntax: string abstract public Ds\Sequence::join ([ string $glue ] ) Parameter: This function accepts single parameter $glue which is optional. It is used to separate the sequence element. Retu
    1 min read
  • PHP DsSet sort() Function
    The Ds\Set::sort() function of DS\Set class in PHP is used to in-place sort the elements of a specified Set instance according to the values. By default, the Set is sorted according to the increasing order of the values. Syntax: void public Ds\Set::sort ([ callable $comparator ] ) Parameters: This f
    2 min read
  • PHP | DsMap sort() Function
    The Ds\Map::sort() function of DS\Map class in PHP is used to in-place sort the elements of a specified Map instance according to the values. By default, the Map is sorted according to the increasing order of the values. Syntax: Ds\Pair public Ds\Map::sort ( int $position ) Parameter: This function
    2 min read
  • PHP | DsSequence set() Function
    The Ds\Sequence::set() function is an inbuilt function in PHP which is used to updates a value at a given index. Syntax: void abstract public Ds\Sequence::set ( int $index , mixed $value ) Parameters: This function accepts two parameters as mentioned above and described below: $index: It is used to
    2 min read
  • PHP | DsSet slice() Function
    The Ds\Set::slice() function is an inbuilt function in PHP which is used to return the sub-set of given range. Syntax: Ds\Set public Ds\Set::slice ( int $index [, int $length ] ) Parameters: This function accepts two parameters as mentioned above and described below: $index: This parameter holds the
    2 min read
geeksforgeeks-footer-logo
Corporate & Communications Address:
A-143, 7th Floor, Sovereign Corporate Tower, Sector- 136, Noida, Uttar Pradesh (201305)
Registered Address:
K 061, Tower K, Gulshan Vivante Apartment, Sector 137, Noida, Gautam Buddh Nagar, Uttar Pradesh, 201305
GFG App on Play Store GFG App on App Store
Advertise with us
  • Company
  • About Us
  • Legal
  • Privacy Policy
  • In Media
  • Contact Us
  • Advertise with us
  • GFG Corporate Solution
  • Placement Training Program
  • Languages
  • Python
  • Java
  • C++
  • PHP
  • GoLang
  • SQL
  • R Language
  • Android Tutorial
  • Tutorials Archive
  • DSA
  • Data Structures
  • Algorithms
  • DSA for Beginners
  • Basic DSA Problems
  • DSA Roadmap
  • Top 100 DSA Interview Problems
  • DSA Roadmap by Sandeep Jain
  • All Cheat Sheets
  • Data Science & ML
  • Data Science With Python
  • Data Science For Beginner
  • Machine Learning
  • ML Maths
  • Data Visualisation
  • Pandas
  • NumPy
  • NLP
  • Deep Learning
  • Web Technologies
  • HTML
  • CSS
  • JavaScript
  • TypeScript
  • ReactJS
  • NextJS
  • Bootstrap
  • Web Design
  • Python Tutorial
  • Python Programming Examples
  • Python Projects
  • Python Tkinter
  • Python Web Scraping
  • OpenCV Tutorial
  • Python Interview Question
  • Django
  • Computer Science
  • Operating Systems
  • Computer Network
  • Database Management System
  • Software Engineering
  • Digital Logic Design
  • Engineering Maths
  • Software Development
  • Software Testing
  • DevOps
  • Git
  • Linux
  • AWS
  • Docker
  • Kubernetes
  • Azure
  • GCP
  • DevOps Roadmap
  • System Design
  • High Level Design
  • Low Level Design
  • UML Diagrams
  • Interview Guide
  • Design Patterns
  • OOAD
  • System Design Bootcamp
  • Interview Questions
  • Inteview Preparation
  • Competitive Programming
  • Top DS or Algo for CP
  • Company-Wise Recruitment Process
  • Company-Wise Preparation
  • Aptitude Preparation
  • Puzzles
  • School Subjects
  • Mathematics
  • Physics
  • Chemistry
  • Biology
  • Social Science
  • English Grammar
  • Commerce
  • World GK
  • GeeksforGeeks Videos
  • DSA
  • Python
  • Java
  • C++
  • Web Development
  • Data Science
  • CS Subjects
@GeeksforGeeks, Sanchhaya Education Private Limited, All rights reserved
We use cookies to ensure you have the best browsing experience on our website. By using our site, you acknowledge that you have read and understood our Cookie Policy & Privacy Policy
Lightbox
Improvement
Suggest Changes
Help us improve. Share your suggestions to enhance the article. Contribute your expertise and make a difference in the GeeksforGeeks portal.
geeksforgeeks-suggest-icon
Create Improvement
Enhance the article with your expertise. Contribute to the GeeksforGeeks community and help create better learning resources for all.
geeksforgeeks-improvement-icon
Suggest Changes
min 4 words, max Words Limit:1000

Thank You!

Your suggestions are valuable to us.

What kind of Experience do you want to share?

Interview Experiences
Admission Experiences
Career Journeys
Work Experiences
Campus Experiences
Competitive Exam Experiences