String Manipulations in Drupal I've been retrieving information from  a database for display.

function myid_user_page_form(){   
    $query = db_select('student', 't1',array('target' =&gt; 'import'));
    $result = $query-&gt;fields('t1', array('firstname','middlename'));

    foreach ($result as $record) {
        $info['firstname'] = $record-&gt;firstname; 
        $info['middlename'] = $record-&gt;middlename; 
    }
}


In my case, all data stored in my database is all uppercase. For example:

$info['firstname'] = "ALYSSA"
$info['middlename'] = "ENGANIO"


I want to make "ALYSSA" to "Alyssa" and make "ENGANIO" to "E.". How will I do that in Drupal?
Drupal can help you doing this by its unicode functions.

https://api.drupal.org/api/drupal/includes%21unicode.inc/7

"ALYSSA" to "Alyssa" would be

&lt;?php
  $name = drupal_ucfirst(drupal_strtolower($name));
?&gt;


And "ENGANIO" to "E." would be:

&lt;?php
  $name = drupal_strtoupper(drupal_substr($name, 0, 1)) . '.';
?&gt;