Php implode array by newline


Php implode array by newline : You can use PHP_EOL to implode array by line break.


Php implode array by newline break

$array = implode(PHP_EOL, $array);

Which will break the string at the break line.

Php explode array at line break Example

$array = array('a','b','c');
$string = explode(PHP_EOL, $array);
echo $string;
// will produce 
// a
// b
// c

Advertisements

Add Comment

📖 Read More