Recently I had a task to split a given string at capitalized characters, having those saved in PHP. I’ve invented the following solution:
$str = 'TestMyFuncCall';
var_dump(preg_split('/(?=[A-Z])/', $str, null, PREG_SPLIT_NO_EMPTY));
The result is:
I utilize regular expressions assertions here to avoid character loss.
Hello. For purposes of writting scripts for converting data formats, I have constructed an array, that can be used to replace language codes by their names.
Continue reading “PHP Array of ISO 639-1 language codes => names.”