- substr: documentation ( source)
- in_array: documentation ( source)
- strtolower: documentation ( source)
- ucfirst: documentation ( source)
<?php
function get_position($atts) {
$string = $_SESSION['position'];
$vowels = array("a,e,i,o,u");
$first_letter = strtolower(substr($string,0,1));
if( in_array($first_letter,$vowels) ) {
$string = "an <strong>".ucfirst($string)."</strong>";
} else {
$string = "a <strong>".ucfirst($string)."</strong>";
}
return $string;
}
$output = get_position("Advertising");
echo $output;