How to Explode String Right to Left?

前端 未结 12 798
灰色年华
灰色年华 2020-12-31 03:22
$split_point = \' - \';
$string = \'this is my - string - and more\';

How can i make a split using the second instance of $split_point and not the

12条回答
  •  一向
    一向 (楼主)
    2020-12-31 03:38

    I've stumbled uppon the same, and fixed it like so:

    $split_point = ' - ';
    $string = 'this is my - string - and more';
    
    $reverse_explode = array_reverse(explode($split_point, $string));
    

提交回复
热议问题