Split word by capital letter

后端 未结 2 900
野性不改
野性不改 2020-12-17 20:02

I want to split a word by capital letter in PHP

For example:

$string = \"facebookPageUrl\";

I want it like this:

$a         


        
2条回答
  •  半阙折子戏
    2020-12-17 20:57

    $string = "facebookPageUrl";
    
    preg_match_all('((?:^|[A-Z])[^A-Z]*)', $string, $matches);
    var_dump($matches);
    

    http://ideone.com/wL9jM

提交回复
热议问题