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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T18:59:43+00:00 2026-06-15T18:59:43+00:00

I seem to be having mental issues when it comes to arrays in php.

  • 0

I seem to be having mental issues when it comes to arrays in php. I am not sure why, How ever my array looks like this:

  $elementOptions = array(
       array(
          'type' => 'Text',
          'name' => 'test' ,
          'isRequired' => true,
          'attributes' => array(
          'placeholder' => 'content'  
      ),

      'subFormName' => 'content'
  );

I have a for each loop as such:

foreach ($options as $key => $value) {
    if (is_array($value)) {
        //do something else
    } else {
        //do something                 
    }        
}

The issue is, if I do a var dump inside the if(isarray()){} I get the following back:

array(1) {
  ["placeholder"]=>
  string(7) "content"
}

array(4) {
  ["type"]=>
  string(4) "Text"
  ["name"]=>
  string(4) "test"
  ["isRequired"]=>
  bool(true)
  ["attributes"]=>
  array(1) {
    ["placeholder"]=>
    string(7) "content"
  }
}

now the issue is – I do not want the following in that var dump:

array(1) {
  ["placeholder"]=>
  string(7) "content"
}

I am not sure, based on the “data structure” above, how this ‘placeholder’ => ‘content’ is considered an array…..in either case I do not want it as part of the arrays that are var dumped…. it should just be the second array in that var dump coming back.

And that’s where you guys come in, why is the place holder coming back as an array when it shouldn’t (TMK – to my knowledge).

  • 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-15T18:59:44+00:00Added an answer on June 15, 2026 at 6:59 pm

    “placeholder”=>”content” isn’t considered an array or coming back as an array, it’s a pair in an array that you’ve called “attributes”

    array(4) {
      ["type"]=>
      string(4) "Text"
      ["name"]=>
      string(4) "test"
      ["isRequired"]=>
      bool(true)
    
      ["attributes"]=> // this is your array
      array(1) {       // contents of this array are...
        ["placeholder"]=>   // this is a key
        string(7) "content" // this is a variable
      }                // array ends
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Seem to be having some issues storing the current date in a core data
Not sure if this is a javascript issue or can be solved with CSS.
I seem to be having issues. I have a query string that has values
I seem to be having a strange problem which I can't fully understand. This
Okay, I'm having a bit of a mental block today/this week, so I'm probably
I seem to be having some issues while attempting to implement logging into my
I seem to be having a problem with long polling and IE. This is
I seem to be having some trouble finding the answer to this one. My
I seem to be having trouble getting rid of this second bar, shown here:
I seem to be having a device specific problem with this code below, as

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.