Skip to:
Content
Pages
Categories
Search
Top
Bottom

explode function

  • @flashvilla

    Participant

    Good day I would like to know how to explode a list of comma delimited items that viewed through a short code.

    e.g. “bp_member_profile_data(‘field=School Needs: Social Welfare’)” outputs “Environmental programmes, Sports development”

    I would like to use the explode php function method to split the two by its comma delimiter.

Viewing 3 replies - 1 through 3 (of 3 total)
  • @petervandoorn

    Participant

    Off the top of my head, it should just be a case of :

    $needs = explode( ", ", bp_member_profile_data(‘field=School Needs: Social Welfare’) );

    Which should then put an array into $needs like this:

    Array
    (
        [0] => Environmental programmes
        [1] => Sports development
    )

    http://php.net/manual/en/function.explode.php

    @henrywright

    Moderator

    @petervandoorn almost but bp_member_profile_data() will output. Instead, you’ll need to use a function which returns a value before passing it to explode(). That’ll be bp_get_member_profile_data()

    @petervandoorn

    Participant

    @henrywright Like I said… off the top of my head 🙂

Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.
Skip to toolbar