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 8571715
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T18:50:32+00:00 2026-06-11T18:50:32+00:00

I got confused when I was trying to access an array element directly with

  • 0

I got confused when I was trying to access an array element directly with its index. I guess I could explain it better in coding:-

I am having an object of Employee Class and I TypeCast it to array and tried to display it like this:

$arrOfObj = (array) $objEmployee;

$arrKeys = array_keys( $arrOfObj );

display( $arrOfObj ); // display() is a method in my library that prints an array in a mannered way.

this gives me the following output :-

Array
(
   [*m_UserId] => 1155
   [*m_EmailPassword] => 
   [*m_IsAssignedToManagementCompany] => 
   [*m_ManagementCompanyId] => 
   [*m_DepartmentId] => 3
   [*m_DesignationId] => 4
   [*m_EmployeeCompletedMonth] => 
   [*m_EmployeeCompletedDay] => 
   [*m_EmailAddress] =>showket.mca@gmail.com
   ------
   ------
 )

Now here I dont understand this Star(*). when my member variables are simple like m_UserId, m_EmialPassword and So on where from it gets this Star. and when I try to display the same with following 2 statements I got an error :-

display( $arrOfObj['*m_EmailAddress'] );

or

display( $arrOfObj['m_EmailAddress'] );

Both give the Error message Undefined index: m_EmailAddress

And when i try to do it this way It works fine :-

display( $arrOfObj[$arrKeys[8]] );

The last one works fine, Can anyone explain me the problem.

            display( $arrOfObj[$arrKeys[11]] );
            display( $arrOfObj['m_strEmailAddress'] );
  • 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-06-11T18:50:33+00:00Added an answer on June 11, 2026 at 6:50 pm

    If an object is converted to an array, the result is an array whose elements are the object’s properties. The keys are the member variable names, with a few notable exceptions: integer properties are unaccessible; private variables have the class name prepended to the variable name; protected variables have a ‘*’ prepended to the variable name. These prepended values have null bytes on either side.

    http://php.net/manual/en/language.types.array.php#language.types.array.casting

    Try var_dump(bin2hex($arrKeys[8])) for enlightenment. Also see the example in the above linked manual.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I was experimenting with array of pointers address calculation arithmetic.I got confused with the
Today i was reading about pure function, got confused with its use: A function
Trying to learn F# but got confused when trying to distinguish between fold and
This has got me all confused! I'm trying to return the max value from
So I'm trying to figure out how the FAT FS works and got confused
i've got confused trying to change the map controls like said here But don`t
i got this javascript, trying to remove a class on a parent element: $(this).parents(.box).removeClass(expanded);
I was trying to understand the memory structure of HotSpot JVM and got confused
I am trying to rotate vectors using matrices, but got confused. I thought all
I have been trying to use OleDbDataAdapter to update a DataTable but got confused

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.