I'm creating a way to filter a set of blog posts by the first letter of the title. The only trouble is that I, of course, want to remove 'A ', 'An ' and 'The ' from the beginning of the titles before I select them by letter. Here's what I'm doing now:
$title = strtolower( $_POST['post_title'] );
$title = substr($title, 0, 2) == 'a ' ? substr($title, 2) : $title;
$title = substr($title, 0, 3) == 'an ' ? substr($title, 3) : $title;
$title = substr($title, 0, 4) == 'the ' ? substr($title, 4) : $title;
That works fine, but it seems pretty clunky. Is there a better way to go about it?