Replace 2 commas separated by space with space using php

后端 未结 4 777
故里飘歌
故里飘歌 2021-01-17 06:10

Hi friends am trying to replace two commas separated by space with space using php. Here is my code

Suppose for example am having variable like

 $va         


        
4条回答
  •  天涯浪人
    2021-01-17 06:15

    You can try by the following solution:

    $var = "hello, welcome, , , ,";
    
    $result = explode(',', $var);
    
    $result = $result[0]. ', '. $result[1];
    
    echo $result;
    

提交回复
热议问题