Replace the last comma with an & sign

后端 未结 8 1341
小鲜肉
小鲜肉 2020-12-09 23:21

I have searched everywhere but can\'t find a solution that works for me.

I have the following:

$bedroom_array = array($studio, $one_bed, $two_bed, $t         


        
8条回答
  •  伪装坚强ぢ
    2020-12-10 00:11

    strrpos finds the last occurrance of a specified string. $str = '1, 2, 3';

    $index = strrpos( $str, ',' ); 
    if( $index !== FALSE )
        $str[ $index ] = '&'; 
    

提交回复
热议问题