Saturday, June 6, 2009

Lower Case an Array

Lower Case an Array

Here is an example of how to force all values in array tolower case. This could, of course, be used in the same way to make the array UPPERCASE or do anything else you wish to the array values. Note the that the string is passed to the array by reference. This is so the actual array values are manipulated.

<?php

/*** an array of mixed case words ***/
$array = array('MAC', 'Apple', 'osX');

/**
*
* @Lower case an array
*
* @param ref string $string
*
* @return string
*
*/
function lower(&$string){
$string = strtolower($string);
}

/*** apply the lower function to the array ***/
array_walk($array,'lower');

foreach($array as $value){
echo $value;
}
?>

ENABLE General logs in MYSQL database

If you were login with root user on mysql database .    Use below command enable log    SET GLOBAL general_log = 'ON' ;   ...