What is the difference between IMPLODE & JOIN

后端 未结 5 1750
春和景丽
春和景丽 2021-02-04 23:10

What is the difference between IMPLODE & JOIN as both works the same way.



        
5条回答
  •  情歌与酒
    2021-02-04 23:59

    join() is an alias for implode(), so implode is theoretically more "PHP native" though there is absolutely no performance increase to be gained by using it.

    On the other hand, join() is found in, amongst other languages, Perl, Python and ECMAScript (including JavaScript) and so is much more portable in terms of comprehensibility to a wider audience of programmers.

    So although explode and implode are unarguably way more dramatic-sounding, I would vote for join as a more universal way to express the concatenation of every value of an array into a string.

提交回复
热议问题