Pound key Hash key hashtag in php arrays

0 votes

I am working in some technology stacks (with drupal) and there's this thing with some render arrays. It is getting pound keys infront of the config indexes of the render arrays that are being utilized by the render functions.

The problem is that it has nothing to do with drupal. The code below is independent from php.

   <?php
    $array = array(
      '#title' => 'Social media button settings',
      '#type' => 'fieldset',
      array(
        '#title' => 'Facebook',
        '#type' => 'input',
      )
    );

    foreach($array as $i => $d) {
      // This line could contain ANY!!! key as long as it starts
      // with a pound key.
      if (isset($d['#title'])) {
        var_dump('Index: ' . $i);
        echo 'Data:';
        var_dump($d);
        var_dump('$d["#title"]: ' . $d['#title']);
      }
    }

Output that is returned:

string 'Index: #title' (length=13)

Data:

string 'Social media button settings' (length=28)

string '$d["#title"]: S' (length=15)

string 'Index: #type' (length=12)

Data:

string 'fieldset' (length=8)

string '$d["#title"]: f' (length=15)

string 'Index: 0' (length=8)

Data:

array (size=2)
  '#title' => string 'Facebook' (length=8)
  '#type' => string 'input' (length=5)

string '$d["#title"]: Facebook' (length=22)

Expected result should be:

string 'Index: 0' (length=8)

Data:

array (size=2)
  '#title' => string 'Facebook' (length=8)
  '#type' => string 'input' (length=5)

string '$d["#title"]: Facebook' (length=22)

What is wrong? 

Aug 1, 2022 in Others by krishna
• 2,820 points
551 views

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.

Related Questions In Others

0 votes
0 answers

How can I sort arrays and data in PHP?

These are my primary questions: How do I ...READ MORE

Aug 8, 2022 in Others by krishna
• 2,820 points
450 views
0 votes
1 answer

Using unserialize in PHP throws the same error repeatedly

I googled 'Node no longer exists', and ...READ MORE

answered Nov 14, 2018 in Others by DataKing99
• 8,250 points
1,595 views
0 votes
1 answer

Where is the documentation to refer for coinbase api integration of Etherium coin currency in php?

Hey there! Please refer to the following ...READ MORE

answered Jan 25, 2019 in Others by Omkar
• 69,220 points
845 views
0 votes
1 answer

The uploaded file exceeds the upload_max_filesize directive in php.ini error while uploading plugin

After looking at your ERROR, it seems ...READ MORE

answered Feb 8, 2022 in Others by Soham
• 9,710 points
686 views
0 votes
1 answer

How to echo WP SEO Yoast synonyms in PHP?

 the meta_key in wp_postmeta table is _yoast_wpseo_keyword ...READ MORE

answered Feb 10, 2022 in Others by narikkadan
• 63,600 points
1,133 views
0 votes
1 answer

How do I get the current date and time in PHP?

The time would go by your server ...READ MORE

answered Feb 16, 2022 in Others by Aditya
• 7,680 points
714 views
0 votes
1 answer

How to check if array is multidimensional or not?

Since the 'second dimension' could be just ...READ MORE

answered Nov 5, 2018 in Others by DataKing99
• 8,250 points
5,947 views
0 votes
1 answer

How to store input value into array then localstorage?

Hello @ abhittac, You have create the array everytime the ...READ MORE

answered Jul 24, 2020 in Java-Script by Niroj
• 82,840 points
9,173 views
0 votes
1 answer

Convert a PHP object to an associative array

Start with simply typecasting the line:- $array = ...READ MORE

answered Feb 23, 2022 in PHP by Aditya
• 7,680 points
2,085 views
0 votes
0 answers

php var_dump() vs print_r()

What is the difference between var_dump() and print_r() in terms of ...READ MORE

May 28, 2022 in PHP by Kichu
• 19,040 points
518 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP