Convert an array to a string PHP

How to convert an array to a string in PHP

Posted by Ervin Adams on November 28, 2022

Convert an array to a string PHP

How to convert an array to a string in PHP

Posted by Ervin Adams on November 28, 2022

If your given an array to convert to a string.

Here is how it's done.

Use the implode() method as below:

<?php  
  
// Declare an array 
$array = array("Welcome","to", "the", "WeCode101", "platform");  
    
// Convert array into string
echo implode(" ",$array); //Output: Welcome to the WeCode101 platform

 

Any question?
This field is required
Your question have been successfully submitted and will be reviewed before published
Please login to ask a question