In this tutorial learn how to implodes an array with any value or without like (,.) etc.
TUTORIAL
OUTPUT : demo
function implodeArr($array, $with = '') { return implode($with, $array); }
TUTORIAL
<?php
$array = Array
(
'3' => 10,
'2' => 2,
'5' => 'Nakiya',
);
/**
* Implodes an array.
*
*string $with What to implode it with
*
* @return String
*/
function implodeArr($array, $with = '')
{
return implode($with, $array);
}
var_dump(implodeArr($array,','));
OUTPUT : demo
string(11) "10,2,Nakiya"
No comments:
Post a Comment