CopyPastehas never been so tasty!

Convert array into string using implode () function in PHP

by anonymous

  • 0
  • 0
  • 0
69 views

http://codingvilla.com/convert-array-string-implode-function-php-single-article-660.aspx Arrays: Arrays are just like the variable that store values but arrays can use to store more than one value. Variable only store one value. There are three types of arrays · Numeric arrays · Associative array · Multidimensional array String: Strings are the collection of characters represent as a single value. When we assign a string to a variable it must be in double quotation marks. Syntax: $var=”string”; Implode () function in php: Implode function are used to convert an array into string. We used it to bring back an array in to string. Syntax: Implode(separator,array) Separator: is used to define where to break a string. Array:that was break into string. Convert array into string using implode () function in php: To convert array into string we use built-in function implode () of php. This function takes two parameters in which both parameters are required. In the given code we have a array and we have to convert it into string by using implode () function. Code: <?php $dimsum = array('A','B','C'); $menu = implode(', ', $dimsum); print $menu; ?> Above is a simple code to convert array into string using implode() function in PHP. This simple article tells that how we can convert array into string using implode() function in PHP.

Add A Comment: