What is implode in PHP?

The implode is a built-in function in PHP to joins array elements with the help of glue. The implode takes an array and glue for performing this action.

Syntax:

<?php
    implode(glue,array);
?>

Parameter:

glue(optional): glue describes with which element needs to join the array elements.
This parameter is optional and it will take empty string if not passed. So it is recommended that the parameter should be passed for glue

array(required): array elements which needs to join

Examples:

<?php
	$arrayObject = array('The','Code','Tutorial');
	echo implode($arrayObject); //This will take glue as empty string and output will be TheCodeTutorial
	echo '<br/>';
	echo implode(' ',$arrayObject); //This will take glue as space string and output will be The Code Tutorial
?>

Output:

TheCodeTutorial
The Code Tutorial