Reputation: 5959
var_dump(implode(',', array('11','22')));
And
var_dump(implode(array('11','22'), ','));
Which is right?
Upvotes: 0
Views: 65
Reputation: 10071
Read this:
implode() can, for historical reasons, accept its parameters in either order. For consistency with explode(), however, it may be less confusing to use the documented order of arguments.
Taken from http://php.net/manual/en/function.implode.php
Both are accepted, but as it says above - documented order of arguments should be used.
Upvotes: 1
Reputation: 57695
According to the documentation on implode():
implode() can, for historical reasons, accept its parameters in either order. For consistency with explode(), however, it may be less confusing to use the documented order of arguments.
The documented description is:
string implode ( string $glue , array $pieces )
implode(',', array('11','22'))
(the documented order) is identical to implode(array('11','22'), ','))
. Both create the string 11,22
.
Upvotes: 5