PHP

PHP Menu

PHP

array_change_key_case() Function - Definition, Syntax, Parameters, Examples

Definition

The array_change_key_case() function changes all keys in an array to lowercase or uppercase.

Syntax

array_change_key_case(array, case)

Parameters

Parameter Description
array Required. Specifies the array to use
case Optional. CASE_LOWER - Default value. Changes the keys to lowercase; CASE_UPPER - Changes the keys to uppercase

Example

<?php
$countries = array("Mark" => "DE", "Jeff" => "PH", "Mike" => "RU"); array_change_key_case($countries, CASE_UPPER);
foreach($countries as $x => $x_value) { echo "Name = " . $x . ", Country = " . $x_value; echo "<br>"; }

Introduction

PHP Basics

PHP Advance

PHP OOP

PHP Functions and Methods