We make use of implode() method/function in PHP to change the array into a string.
implode() function has a parameter to pass the array in it that you want to be converted into a string.
This method will joint all the values of array from different-different indexing numbers and then displayed as a single string.
Use echo to print the string.
PHP implode() function example
<?php $data = ["Apple","Samsung","Xiaomi","Realme","Oppo","Vivo"]; $arr_string = implode($data); echo $arr_string; ?>
Output ~ AppleSamsungXiaomiRealmeOppoVivo
|1: Print Array in PHP|
2: get string length
3: Print length of an array
4: Intro to SQL
5: Change class of HTML element in JS
6: Get window's live width when resizing in JS
7: SORT BY query in SQL
Publish A Comment