Php program to merge the array elements into a string

A simple php program to merge the array elements into a string. By using this program we can print merge the array elements into string. To force something to come together or consolidate; unify to progressively merge, blend, or unite so that the individuality or individual identity of: They decided to combine the two branch offices into one.

<?php
$arr = array("welcome", "to", "inlarn");
echo join(" ",$arr);
?>

 

Output

welcome to inlarn

What is array and how it useful

A data structure that contains a group of elements is known as an array. These items are usually all of the same data type, such as an integer or a string. A search engine, for example, might utilise an array to store Web sites found during a user’s search.

What is string in php program

The term “string” refers to a group of characters. PHP supports a number of data types, including strings. Alphanumeric characters are allowed in string variables. When you generate a string, you can use it straight with the echo statement in PHP.

How to declare array in php

PHP includes a number of array methods for accessing and manipulating array items. The most essential array methods in PHP are listed here. The array () function in PHP is used to build and return an array. You can make indexed, associative, and multidimensional arrays with it.