Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

array to string using php method

<?php

$array = array('lastname', 'email', 'phone');
$comma_separated = implode(",", $array);

echo $comma_separated; 
//OR
$array = array('lastname', 'email', 'phone');
$comma_separated = join(",", $array);
echo $comma_separated; 

// lastname,email,phone

/* 
  The implode() method is an inbuilt function in PHP and is used to join 
  the elements of an array. 

  The implode() method is an alias for PHP | 
  
  join() function and works exactly same as that of join() function.
*/
?>
Source by www.delftstack.com #
 
PREVIOUS NEXT
Tagged: #array #string #php #method
ADD COMMENT
Topic
Name
8+1 =