Created
March 28, 2012 22:11
-
-
Save Relequestual/2230990 to your computer and use it in GitHub Desktop.
Split a string which starts with lowercase then uses camel case from first capital letter.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
/ Created while using the Last.FM API. | |
/ The Last.FM API is split into sections. Artists, Album, Track etc. | |
/ The method names are for example "artists.getTopTracks". If I'm using magic method __call | |
/ and calling artistsGetTopTracks, I can then split the call down into the section and method with the following regex | |
/ which can then be used to construct API call URL | |
*/ | |
preg_match_all('/^[a-z]*|[A-Z]\w*/', $candidate, $results); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment