PHP Join Example | PHP join() Function Tutorial
PHP join() is an inbuilt function that returns the string from the items of an array. The join() function is an alias of an implode() function. The separator parameter of join() is optional. However, it is recommended to always use the two parameters for backward compatibility.
PHP Join Example
The join() function is a built-in function in PHP and is used to join the array of items that are separated by the string. The syntax of join() function is the following.
The separator parameter is optional, and it specifies what to put between the array elements. Default is ” “.
The array parameter is required, and it is the array to join.
See the following example.
<?php // app.php $data = ['Google', 'Youtube', 'Facebook', 'Amazon']; echo join(" ",$data)."\n"; echo join(" + ",$data)."\n"; echo join(" - ",$data)."\n"; echo join(" | ",$data);
See the below output.
That is it for the PHP Join Example | PHP join() Function Tutorial.