Using strtolower() on an array, is there a way to make the output below lower case?
<?=$rdata['batch_id']?> strtolower($rdata['batch_id'])
strtolower() - It converts a string into uppercase. lcfirst() - It converts the first character of a string into lowercase. ucfirst() - It converts the first character of a string into uppercase. ucwords() - It converts the first character of each word in a string into uppercase.
The strtolower() function converts a string to lowercase. Note: This function is binary-safe. Related functions: strtoupper() - converts a string to uppercase.
The in_array() function is an inbuilt function in PHP that is used to check whether a given value exists in an array or not. It returns TRUE if the given value is found in the given array, and FALSE otherwise.
The correct function name is strtolower(). If you want to apply this on each element of the array, you can use array_map():
$array = array('ONE', 'TWO'); $array = array_map('strtolower', $array);
Now your array will contain 'one' and 'two'.
If you have a bunch of arrays with key-value pairs and you want to change the keys to lower case only, then this is your solution:
$lower_array_keys = array_change_key_case($array, CASE_LOWER);
Take a look at array_change_key_case.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With