my string:
'kcp-pro;first_name last_name;address;zipcode;country' //for example: 'kcp-pro;jon doe;box 564;02201;usa' or 'kcp-sat-pro;first_name last_name;address;zipcode;country'
how can change first part (kcp-pro or kcp-sat-pro) , change (kcp,pro or kcp,sat,pro)? outcome has be:
'kcp,pro;first_name last_name;address;zipcode;country' or 'kcp,sat,pro;first_name last_name;address;zipcode;country'
i haven't tried code myself guess trick
$string = 'kcp-sat-pro;first_name last_name;address;zipcode;country'; $stringexploded = explode(';', $string); $stringexploded[0] = str_replace('-', ',', $stringexploded[0]); $output = implode(';', $stringexploded); //output should kcp,sat,pro;first_name last_name;address;zipcode;country
hope helps :)
Comments
Post a Comment