php explode at capital letters?

前端 未结 4 1924
孤城傲影
孤城傲影 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:45

    Look up preg_split

    $result = preg_replace("([A-Z])", " $0", "helloMister");
    print_r(explode(' ', $result));
    

    hacky hack. Just don't have spaces in your input string.

提交回复
热议问题