PHPWarning: implode () [function. implode]: Invalid

Source: Internet
Author: User
When I made a small collection and publishing interface today, I found that an error was prompted when I used the implode function, but I couldn't solve it after I found it on the internet. later I checked it carefully because the writing was wrong, of course, I have learned a lot about this problem. I have sorted out some more reasonable ways to use implevels... when I made a small collection and publishing interface today, I found that an error was prompted when I used the implode function, but I couldn't solve it after I found it on the internet. later I checked it carefully because the writing was wrong, of course, I have also learned a lot about this problem. I have sorted out some more reasonable use of the implode () function.

The code of my program is as follows:

Echo $ fileddata ['House _ feature ']; if ($ fileddata ['House _ feature']) {$ fileddata ['House _ feature '] = implode (' | ', $ fileddata ['House _ feature']);} echo '----'. $ fileddata ['House _ feature ']

Result: North-South transparent | house view at any time | convenient transportation --------

I did not find out the cause repeatedly. baidu searched for a netizen who said that implode (',', $ goods_attr) was not scientific at all and should be judged. if ($ goods_attr), can this implode only convert the array into characters? Baidu's mplode () function combines array elements into a string.

Parameter description

Optional. specifies the content to be placed between array elements. the default value is "" (null string ).

Array is required. it must be an array of strings.

The code is as follows:

$ Fileddata ['House _ feature '] = str_replace (' | ', $ fileddata ['House _ feature']);

Test the North-South visibility | visit the house at any time | the transportation is convenient and the North-South visibility is provided at any time. convenient transportation is the result I want.


Tutorial address:

Reprinted! But please include the article address ^

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.