How to Implode Array

The implode() function returns a string from the elements of an array or Join array elements with a string…

The implode() function returns a string from the elements of an array or Join array elements with a string.

Key Concept :

  •  The implode() function accept its parameters in either order.
  •  The separator parameter of implode() is optional. However, it is recommended to always use two parameters for backwards compatibility.
  •  This function is binary-safe.

Syntax :

implode(separator,array)

Separator :-  Optional. Specifies what to put between the array elements. Default is “” (an empty string).
Array  :- Required. The array to join to a string.

Example for implode() function:

<!DOCTYPE html>
<html>
<body>

<?php
$arr = array('Hello','World!','Beautiful','Day!');
echo implode(" ",$arr);
?>

</body>
</html>

Output : Hello World! Beautiful Day!

Thanks for reading !…..

Related Posts

Log4j Software Vulnerability
Read Time5 min read
13 Dec 2021
By

The Log4j Software Vulnerability Prompts an Urgent Warning by the US Government’s Cybersecurity Agency

If you have not heard of the Log4j software vulnerability, this article provides a brief background on what the Log4j […]

Read Time5 min read
31 Oct 2020
By

Why to Have a Family-like Environment at Workplace?

The family is the cornerstone for every evolution. It is the pillar that binds the individuals in a close knot […]

Virtual Team communication
Read Time5 min read
09 Oct 2020
By

Virtual Team Communication – Best Practices

Virtual Team Communications are an essential part of every Business Continuity Plans or BCP and organisations create a robust infrastructure to ensure the process kicks in when most needed. Most companies have adapted to project management tools with integrated emailing systems which allow the admin and the users to participate seamlessly.