Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6078575
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T10:50:57+00:00 2026-05-23T10:50:57+00:00

Am using DB2 with my PHP. DB2 returns all column names in UPPERCASE. If

  • 0

Am using DB2 with my PHP. DB2 returns all column names in UPPERCASE. If I use db2_fetch_assoc, then the result would be like this

Array { [USERID] => 4 }

But in my php file, the array values assigned like this and its in camelstyle

$this->userId = $row['userId'];

So it throws the error Error : Undefined index userId

I can use array_change_key_case() function to convert the array to lowercase. But I have hundreds of files which get and assign the array values.

Its not possible to change in all of my files. Also its linux machine.

So is there any function available in php to disable the case sensitivity of array keys.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T10:50:58+00:00Added an answer on May 23, 2026 at 10:50 am

    You can extend ArrayObject from the SPL.
    This way at least you only have to “touch” the functions/methods that get the data from the database.

    $row = getRow();
    echo $row['userId'];
    
    function getRow() {
        $row = array ( 'USERID' => 4, 'FOO'=>123, 'BAR'=>456 );
        return new UCArrayObject($row);
    }
    
    class UCArrayObject extends ArrayObject
    {
        public function offsetExists ($index) { return parent::offsetExists(strtoupper($index)); }
        public function offsetGet($index) { return parent::offsetGet(strtoupper($index)); }
        public function offsetSet ($index, $newval) { parent::offsetSet(strtoupper($index), $newval); }
        public function offsetUnset ($index) { parent::offsetUnset(strtoupper($index)); }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using DB2 in this case, but I'm figuring this has a generic
Im using php to do this: while ($row = mysql_fetch_object($db_list)) { echo $row->Database .
Given data in a column which look like this: 00001 00 00026 00 I
As a developer using DB2 for the first time, I'm not familiar with what
I'm running an SQL query against a mainframe DB2 database using the OdbcDataReader class
Hi im using sqlalchemy on a db2 table with 500k rows. using plain sql
Using PyObjC , you can use Python to write Cocoa applications for OS X.
Hibernate criteria, using DB2 dialect, generates the following SQL with composite keys in the
i'm trying to configure a datasource of an db2 database in tomcat (using eclipse
I'm trying to connect to a DB2 databse from a windows machine using XAMPP.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.