php explode at capital letters?

前端 未结 4 1941
孤城傲影
孤城傲影 2020-12-28 12:23

I have strings like:

$a = \'helloMister\';
$b = \'doggyWaltz\';
$c = \'bumWipe\';
$d = \'pinkNips\';

How can I explode at the capital lette

4条回答
  •  鱼传尺愫
    2020-12-28 12:53

    Extending Mathew's Answer, this works perfectly,

    $arr = preg_replace("([A-Z])", " $0", $str);
    $arr = explode(" ",trim($arr));
    

提交回复
热议问题