- var_dump: documentation ( source)
- strpos: documentation ( source)
- get_defined_constants: documentation ( source)
- array_filter: documentation ( source)
- printf: documentation ( source)
<?php
var_dump(get_defined_constants(true));
$constants = array_filter(get_defined_constants(true)['intl'], function($name){
return strpos('CHAR_CATEGORY_', $name) !== false;
});
IntlChar::enumCharTypes(function($start, $end, $type) {
printf("U+%04x through U+%04x are in category %d\n", $start, $end, $constants[$type]);
});