arrays - PHP: implode() Invalid arguments passed -
i using codeigniter , validation rules - custom callback validation. anyway, seems not ci related think.
i've got function return string …
function array_implode($a) { return implode(',', $a); }
… message implode(): invalid arguments passed
but var_dump()
shows me this:
array(2) { [0]=> string(10) "first item" [1]=> string(11) "second item" }
what wrong?
why? why write function, calls std function? why not write implode(',', $array);
instead of adding overhead of function call?
also: var_dump
puts out array? dump of $a
inside array_implode
function? sure $a
going array, , insist on keeping array_implode
function, edit code this:
function array_implode(array $a) {//type hinting: function work if $a array return implode(',',$a); }
Comments
Post a Comment