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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T04:47:52+00:00 2026-06-10T04:47:52+00:00

hello i am learning PHP and came upon this multi-level array after using print_r

  • 0

hello i am learning PHP and came upon this multi-level array after using print_r on $this->root

 Array ( 
    [0] => 9 
    [obj] => 3562 
    [gen] => 0 
    [1] => Array ( 
        [0] => 5 
        [1] => Array ( 
            [/AcroForm] => Array ( 
                [0] => 8 
                [1] => 3563 
                [2] => 0 
                ) 
            [/Metadata] => Array ( 
                [0] => 8 
                [1] => 3559 
                [2] => 0 
                ) 
            [/PageLabels] => Array ( 
                [0] => 8 
                [1] => 3389 
                [2] => 0 
                ) 
            [/Pages] => Array ( 
                [0] => 8 
                [1] => 3392 
                [2] => 0 
                ) 
            [/Type] => Array ( 
                [0] => 2 
                [1] => /Catalog 
                ) 
            ) 
        ) 
    ) Array ( 
        [0] => 9 
        [obj] => 8 
        [gen] => 0 
        [1] => Array ( 
            [0] => 5 
            [1] => Array ( 
                [/Type] => Array ( 
                    [0] => 2 
                    [1] => /Catalog 
                    ) 
                [/Pages] => Array ( 
                    [0] => 8 
                    [1] => 1 
                    [2] => 0 
                    ) 
                [/OpenAction] => Array ( 
                    [0] => 6 
                    [1] => Array ( 
                        [0] => Array ( 
                            [0] => 8 
                            [1] => 3 
                            [2] => 0 
                            ) 
                        [1] => Array ( 
                            [0] => 2 
                            [1] => /FitH 
                            ) 
                        [2] => Array ( 
                            [0] => 0 
                            ) 
                        ) 
                    ) 
                [/PageLayout] => Array ( 
                    [0] => 2 
                    [1] => /OneColumn 
                    ) 
                ) 
            ) 
        ) 

i have an question about the behavior of using multi-level arrays, i want to use this function

$pages = $this->pdf_resolve_object($this->c, $this->root[1][1]['/Pages']);

and $this->root[1][1]['/Pages'] which i believe is used to check the array for these keys and if it exists then use as variable for pdf_resolve_object

so my question is 2-fold, one is does $this->root[1][1]['/Pages'] check the array and goes through the keys? if not what is its behavior? and 2 when it checks the array does it go through just the top 4 keys or all of the sub-keys?

If someone can help or link me to some learning material that would be much appreciated, thank you!

  • 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-10T04:47:54+00:00Added an answer on June 10, 2026 at 4:47 am

    1) It does not check for the presence of the array keys — rather it assumes that those keys already exist and passes the value into the function. If any of the keys did not exist, PHP would issue an E_NOTICE to the effect of Notice: Undefined index: that the key was not found. To check for them would require a call to isset() or array_key_exists() like:

    if (isset($this->root[1][1]['/Pages'])) {
      $pages = $this->pdf_resolve_object($this->c, $this->root[1][1]['/Pages']);
    }
    

    2) There is no need for it to iterate through to find the keys. Knowing the array keys already means they can be accessed directly without iteration. In memory, PHP has stored the array keys and the memory locations of the values they point to. Therefore, with the key alone, PHP can return the value without needing to traverse the array.

    There is a lot of good information in the PHP manaul on Arrays

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

Sidebar

Related Questions

Hello I am just learning more about using classes in PHP. I know the
Hello Guys! I started learning python GUI development. Let's say I have this script:
I am learning PHP and I am at this point learning how to validate
Hello I am new to codeigniter. I am learning this framework by developing a
hello I'm learning php and i have seen many empty Function in many other
im learning php and to keep it simple (i think), this is what im
I'm learning PHP and I don't know how to get this to even work.
Hello i am learning qt and trying to upload a file using QFtp i
Hello i am learning php i tried to use the date function to display
Hello and Good Morning, I am still learning PHP and for some reason my

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.