How to make a text string into a bullet list [closed]

If your string is delimited by a comma , you can explode the string at this point into pieces (an array of items). If your string is separated by something else, such as spaces or | then explode that instead.

<?php 
//assuming your string might look like: "USA, Canada, Japan, Russia"
$countries = bp_member_profile_data( 'field=Countries' );

$array = explode(",", $countries);
//$array[0] = USA
//$array[1] = Canada
//$array[2] = Japan
//$array[3] = Russia

if ( ! empty( $countries ) ) {
    echo '<ul>';
    foreach ( $array as $country ) {
        printf( '<li>%s</li>', $country );
    }
    echo '</ul>';
}

/* Result
<ul>
<li>USA</li>
<li>Canada</li>
<li>Japan</li>
<li>Russia</li>
</ul>
*/
?>