jasteele123

function a_or_n($str)

Apr 3rd, 2012
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.14 KB | None | 0 0
  1. <?php
  2. function a_or_an($str) {
  3.     $vowels = array('a', 'e', 'i', 'o', 'u');
  4.     return ((in_array($str[0], $vowels) ? 'an' : 'a'). ' '. $str);
  5. }
  6. ?>
Advertisement
Add Comment
Please, Sign In to add comment