PHP: Get key from array?












49















I am sure that this is super easy and built-in function in PHP, but I have yet not seen it.



Here's what I am doing for the moment:



foreach($array as $key => $value) {
echo $key; // Would output "subkey" in the example array
print_r($value);
}


Could I do something like the following instead and thereby save myself from writing "$key => $value" in every foreach loop? (psuedocode)



foreach($array as $subarray) {
echo arrayKey($subarray); // Will output the same as "echo $key" in the former example ("subkey"
print_r($value);
}


Thanks!



The array:



Array
(
[subKey] => Array
(
[value] => myvalue
)

)









share|improve this question




















  • 11





    Whats wrong with foreach($array as $key => $value)? Or, asked the other way around, what's the point using foreach($array as $value) when you actually need $key somewhere down the road?

    – Tomalak
    Jul 23 '10 at 12:10






  • 2





    I just thought it could be a good idea to get the key in a quick way

    – Industrial
    Jul 23 '10 at 12:12






  • 1





    But you do get it in a quick way with foreach($array as $key => $value)... :-) Or is the situation not that you are in a foreach loop?

    – Tomalak
    Jul 23 '10 at 12:14











  • I am in a foreach loop for sure, but what i've thought about was to not change the foreach statement, but just printing out the key.

    – Industrial
    Jul 23 '10 at 12:21






  • 3





    Every function call you could make would be less efficient than simply changing to the appropriate foreach loop construct.

    – Tomalak
    Jul 23 '10 at 13:48
















49















I am sure that this is super easy and built-in function in PHP, but I have yet not seen it.



Here's what I am doing for the moment:



foreach($array as $key => $value) {
echo $key; // Would output "subkey" in the example array
print_r($value);
}


Could I do something like the following instead and thereby save myself from writing "$key => $value" in every foreach loop? (psuedocode)



foreach($array as $subarray) {
echo arrayKey($subarray); // Will output the same as "echo $key" in the former example ("subkey"
print_r($value);
}


Thanks!



The array:



Array
(
[subKey] => Array
(
[value] => myvalue
)

)









share|improve this question




















  • 11





    Whats wrong with foreach($array as $key => $value)? Or, asked the other way around, what's the point using foreach($array as $value) when you actually need $key somewhere down the road?

    – Tomalak
    Jul 23 '10 at 12:10






  • 2





    I just thought it could be a good idea to get the key in a quick way

    – Industrial
    Jul 23 '10 at 12:12






  • 1





    But you do get it in a quick way with foreach($array as $key => $value)... :-) Or is the situation not that you are in a foreach loop?

    – Tomalak
    Jul 23 '10 at 12:14











  • I am in a foreach loop for sure, but what i've thought about was to not change the foreach statement, but just printing out the key.

    – Industrial
    Jul 23 '10 at 12:21






  • 3





    Every function call you could make would be less efficient than simply changing to the appropriate foreach loop construct.

    – Tomalak
    Jul 23 '10 at 13:48














49












49








49


12






I am sure that this is super easy and built-in function in PHP, but I have yet not seen it.



Here's what I am doing for the moment:



foreach($array as $key => $value) {
echo $key; // Would output "subkey" in the example array
print_r($value);
}


Could I do something like the following instead and thereby save myself from writing "$key => $value" in every foreach loop? (psuedocode)



foreach($array as $subarray) {
echo arrayKey($subarray); // Will output the same as "echo $key" in the former example ("subkey"
print_r($value);
}


Thanks!



The array:



Array
(
[subKey] => Array
(
[value] => myvalue
)

)









share|improve this question
















I am sure that this is super easy and built-in function in PHP, but I have yet not seen it.



Here's what I am doing for the moment:



foreach($array as $key => $value) {
echo $key; // Would output "subkey" in the example array
print_r($value);
}


Could I do something like the following instead and thereby save myself from writing "$key => $value" in every foreach loop? (psuedocode)



foreach($array as $subarray) {
echo arrayKey($subarray); // Will output the same as "echo $key" in the former example ("subkey"
print_r($value);
}


Thanks!



The array:



Array
(
[subKey] => Array
(
[value] => myvalue
)

)






php arrays multidimensional-array key






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Feb 1 '14 at 18:48









aksu

4,50751837




4,50751837










asked Jul 23 '10 at 11:54









IndustrialIndustrial

15.4k56169275




15.4k56169275








  • 11





    Whats wrong with foreach($array as $key => $value)? Or, asked the other way around, what's the point using foreach($array as $value) when you actually need $key somewhere down the road?

    – Tomalak
    Jul 23 '10 at 12:10






  • 2





    I just thought it could be a good idea to get the key in a quick way

    – Industrial
    Jul 23 '10 at 12:12






  • 1





    But you do get it in a quick way with foreach($array as $key => $value)... :-) Or is the situation not that you are in a foreach loop?

    – Tomalak
    Jul 23 '10 at 12:14











  • I am in a foreach loop for sure, but what i've thought about was to not change the foreach statement, but just printing out the key.

    – Industrial
    Jul 23 '10 at 12:21






  • 3





    Every function call you could make would be less efficient than simply changing to the appropriate foreach loop construct.

    – Tomalak
    Jul 23 '10 at 13:48














  • 11





    Whats wrong with foreach($array as $key => $value)? Or, asked the other way around, what's the point using foreach($array as $value) when you actually need $key somewhere down the road?

    – Tomalak
    Jul 23 '10 at 12:10






  • 2





    I just thought it could be a good idea to get the key in a quick way

    – Industrial
    Jul 23 '10 at 12:12






  • 1





    But you do get it in a quick way with foreach($array as $key => $value)... :-) Or is the situation not that you are in a foreach loop?

    – Tomalak
    Jul 23 '10 at 12:14











  • I am in a foreach loop for sure, but what i've thought about was to not change the foreach statement, but just printing out the key.

    – Industrial
    Jul 23 '10 at 12:21






  • 3





    Every function call you could make would be less efficient than simply changing to the appropriate foreach loop construct.

    – Tomalak
    Jul 23 '10 at 13:48








11




11





Whats wrong with foreach($array as $key => $value)? Or, asked the other way around, what's the point using foreach($array as $value) when you actually need $key somewhere down the road?

– Tomalak
Jul 23 '10 at 12:10





Whats wrong with foreach($array as $key => $value)? Or, asked the other way around, what's the point using foreach($array as $value) when you actually need $key somewhere down the road?

– Tomalak
Jul 23 '10 at 12:10




2




2





I just thought it could be a good idea to get the key in a quick way

– Industrial
Jul 23 '10 at 12:12





I just thought it could be a good idea to get the key in a quick way

– Industrial
Jul 23 '10 at 12:12




1




1





But you do get it in a quick way with foreach($array as $key => $value)... :-) Or is the situation not that you are in a foreach loop?

– Tomalak
Jul 23 '10 at 12:14





But you do get it in a quick way with foreach($array as $key => $value)... :-) Or is the situation not that you are in a foreach loop?

– Tomalak
Jul 23 '10 at 12:14













I am in a foreach loop for sure, but what i've thought about was to not change the foreach statement, but just printing out the key.

– Industrial
Jul 23 '10 at 12:21





I am in a foreach loop for sure, but what i've thought about was to not change the foreach statement, but just printing out the key.

– Industrial
Jul 23 '10 at 12:21




3




3





Every function call you could make would be less efficient than simply changing to the appropriate foreach loop construct.

– Tomalak
Jul 23 '10 at 13:48





Every function call you could make would be less efficient than simply changing to the appropriate foreach loop construct.

– Tomalak
Jul 23 '10 at 13:48












8 Answers
8






active

oldest

votes


















61














You can use key():



<?php
$array = array(
"one" => 1,
"two" => 2,
"three" => 3,
"four" => 4
);

while($element = current($array)) {
echo key($array)."n";
next($array);
}
?>





share|improve this answer



















  • 7





    Hi! But key doesnt work in a foreach, right?

    – Industrial
    Jul 23 '10 at 12:49






  • 3





    I want to add that you can use key() ANYWHERE but for this problem it make sense to use it in a while-loop. You can use key() in the instance of only wanting the first/current array element's key.

    – JRomero
    Nov 21 '12 at 19:50








  • 3





    @Industrial foreach uses the key... if you want to use foreach, do this: foreach($array as $key => $value) { ... }

    – Greg
    Oct 16 '13 at 15:27











  • Dosn't work if the value is equal to 0

    – executable
    Jan 2 at 14:02



















38














Use the array_search function.



Example from php.net



$array = array(0 => 'blue', 1 => 'red', 2 => 'green', 3 => 'red');

$key = array_search('green', $array); // $key = 2;
$key = array_search('red', $array); // $key = 1;





share|improve this answer
























  • Hi, updated my original post with an array example. Thanks!

    – Industrial
    Jul 23 '10 at 12:03



















29














$foo = array('a' => 'apple', 'b' => 'ball', 'c' => 'coke');

foreach($foo as $key => $item) {
echo $item.' is begin with ('.$key.')';
}





share|improve this answer
























  • This needs to be higher

    – Jakob Abfalter
    Feb 22 '16 at 14:57



















13
















$array = array(0 => 100, "color" => "red");
print_r(array_keys($array));






share|improve this answer
























  • what's d difference?

    – gumuruh
    Apr 18 '12 at 9:17



















5














If it IS a foreach loop as you have described in the question, using $key => $value is fast and efficient.






share|improve this answer































    1














    If you want to be in a foreach loop, then foreach($array as $key => $value) is definitely the recommended approach. Take advantage of simple syntax when a language offers it.






    share|improve this answer































      0














      Another way to use key($array) in a foreach loop is by using next($array) at the end of the loop, just make sure each iteration calls the next() function (in case you have complex branching inside the loop)






      share|improve this answer































        0














        Try this



        foreach(array_keys($array) as $nmkey)
        {
        echo $nmkey;
        }





        share|improve this answer

























          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f3317856%2fphp-get-key-from-array%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          8 Answers
          8






          active

          oldest

          votes








          8 Answers
          8






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          61














          You can use key():



          <?php
          $array = array(
          "one" => 1,
          "two" => 2,
          "three" => 3,
          "four" => 4
          );

          while($element = current($array)) {
          echo key($array)."n";
          next($array);
          }
          ?>





          share|improve this answer



















          • 7





            Hi! But key doesnt work in a foreach, right?

            – Industrial
            Jul 23 '10 at 12:49






          • 3





            I want to add that you can use key() ANYWHERE but for this problem it make sense to use it in a while-loop. You can use key() in the instance of only wanting the first/current array element's key.

            – JRomero
            Nov 21 '12 at 19:50








          • 3





            @Industrial foreach uses the key... if you want to use foreach, do this: foreach($array as $key => $value) { ... }

            – Greg
            Oct 16 '13 at 15:27











          • Dosn't work if the value is equal to 0

            – executable
            Jan 2 at 14:02
















          61














          You can use key():



          <?php
          $array = array(
          "one" => 1,
          "two" => 2,
          "three" => 3,
          "four" => 4
          );

          while($element = current($array)) {
          echo key($array)."n";
          next($array);
          }
          ?>





          share|improve this answer



















          • 7





            Hi! But key doesnt work in a foreach, right?

            – Industrial
            Jul 23 '10 at 12:49






          • 3





            I want to add that you can use key() ANYWHERE but for this problem it make sense to use it in a while-loop. You can use key() in the instance of only wanting the first/current array element's key.

            – JRomero
            Nov 21 '12 at 19:50








          • 3





            @Industrial foreach uses the key... if you want to use foreach, do this: foreach($array as $key => $value) { ... }

            – Greg
            Oct 16 '13 at 15:27











          • Dosn't work if the value is equal to 0

            – executable
            Jan 2 at 14:02














          61












          61








          61







          You can use key():



          <?php
          $array = array(
          "one" => 1,
          "two" => 2,
          "three" => 3,
          "four" => 4
          );

          while($element = current($array)) {
          echo key($array)."n";
          next($array);
          }
          ?>





          share|improve this answer













          You can use key():



          <?php
          $array = array(
          "one" => 1,
          "two" => 2,
          "three" => 3,
          "four" => 4
          );

          while($element = current($array)) {
          echo key($array)."n";
          next($array);
          }
          ?>






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Jul 23 '10 at 12:28









          vtorhonenvtorhonen

          2,0591218




          2,0591218








          • 7





            Hi! But key doesnt work in a foreach, right?

            – Industrial
            Jul 23 '10 at 12:49






          • 3





            I want to add that you can use key() ANYWHERE but for this problem it make sense to use it in a while-loop. You can use key() in the instance of only wanting the first/current array element's key.

            – JRomero
            Nov 21 '12 at 19:50








          • 3





            @Industrial foreach uses the key... if you want to use foreach, do this: foreach($array as $key => $value) { ... }

            – Greg
            Oct 16 '13 at 15:27











          • Dosn't work if the value is equal to 0

            – executable
            Jan 2 at 14:02














          • 7





            Hi! But key doesnt work in a foreach, right?

            – Industrial
            Jul 23 '10 at 12:49






          • 3





            I want to add that you can use key() ANYWHERE but for this problem it make sense to use it in a while-loop. You can use key() in the instance of only wanting the first/current array element's key.

            – JRomero
            Nov 21 '12 at 19:50








          • 3





            @Industrial foreach uses the key... if you want to use foreach, do this: foreach($array as $key => $value) { ... }

            – Greg
            Oct 16 '13 at 15:27











          • Dosn't work if the value is equal to 0

            – executable
            Jan 2 at 14:02








          7




          7





          Hi! But key doesnt work in a foreach, right?

          – Industrial
          Jul 23 '10 at 12:49





          Hi! But key doesnt work in a foreach, right?

          – Industrial
          Jul 23 '10 at 12:49




          3




          3





          I want to add that you can use key() ANYWHERE but for this problem it make sense to use it in a while-loop. You can use key() in the instance of only wanting the first/current array element's key.

          – JRomero
          Nov 21 '12 at 19:50







          I want to add that you can use key() ANYWHERE but for this problem it make sense to use it in a while-loop. You can use key() in the instance of only wanting the first/current array element's key.

          – JRomero
          Nov 21 '12 at 19:50






          3




          3





          @Industrial foreach uses the key... if you want to use foreach, do this: foreach($array as $key => $value) { ... }

          – Greg
          Oct 16 '13 at 15:27





          @Industrial foreach uses the key... if you want to use foreach, do this: foreach($array as $key => $value) { ... }

          – Greg
          Oct 16 '13 at 15:27













          Dosn't work if the value is equal to 0

          – executable
          Jan 2 at 14:02





          Dosn't work if the value is equal to 0

          – executable
          Jan 2 at 14:02













          38














          Use the array_search function.



          Example from php.net



          $array = array(0 => 'blue', 1 => 'red', 2 => 'green', 3 => 'red');

          $key = array_search('green', $array); // $key = 2;
          $key = array_search('red', $array); // $key = 1;





          share|improve this answer
























          • Hi, updated my original post with an array example. Thanks!

            – Industrial
            Jul 23 '10 at 12:03
















          38














          Use the array_search function.



          Example from php.net



          $array = array(0 => 'blue', 1 => 'red', 2 => 'green', 3 => 'red');

          $key = array_search('green', $array); // $key = 2;
          $key = array_search('red', $array); // $key = 1;





          share|improve this answer
























          • Hi, updated my original post with an array example. Thanks!

            – Industrial
            Jul 23 '10 at 12:03














          38












          38








          38







          Use the array_search function.



          Example from php.net



          $array = array(0 => 'blue', 1 => 'red', 2 => 'green', 3 => 'red');

          $key = array_search('green', $array); // $key = 2;
          $key = array_search('red', $array); // $key = 1;





          share|improve this answer













          Use the array_search function.



          Example from php.net



          $array = array(0 => 'blue', 1 => 'red', 2 => 'green', 3 => 'red');

          $key = array_search('green', $array); // $key = 2;
          $key = array_search('red', $array); // $key = 1;






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Jul 23 '10 at 11:56









          SarfrazSarfraz

          299k64471547




          299k64471547













          • Hi, updated my original post with an array example. Thanks!

            – Industrial
            Jul 23 '10 at 12:03



















          • Hi, updated my original post with an array example. Thanks!

            – Industrial
            Jul 23 '10 at 12:03

















          Hi, updated my original post with an array example. Thanks!

          – Industrial
          Jul 23 '10 at 12:03





          Hi, updated my original post with an array example. Thanks!

          – Industrial
          Jul 23 '10 at 12:03











          29














          $foo = array('a' => 'apple', 'b' => 'ball', 'c' => 'coke');

          foreach($foo as $key => $item) {
          echo $item.' is begin with ('.$key.')';
          }





          share|improve this answer
























          • This needs to be higher

            – Jakob Abfalter
            Feb 22 '16 at 14:57
















          29














          $foo = array('a' => 'apple', 'b' => 'ball', 'c' => 'coke');

          foreach($foo as $key => $item) {
          echo $item.' is begin with ('.$key.')';
          }





          share|improve this answer
























          • This needs to be higher

            – Jakob Abfalter
            Feb 22 '16 at 14:57














          29












          29








          29







          $foo = array('a' => 'apple', 'b' => 'ball', 'c' => 'coke');

          foreach($foo as $key => $item) {
          echo $item.' is begin with ('.$key.')';
          }





          share|improve this answer













          $foo = array('a' => 'apple', 'b' => 'ball', 'c' => 'coke');

          foreach($foo as $key => $item) {
          echo $item.' is begin with ('.$key.')';
          }






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Aug 26 '12 at 13:27









          Somwang SouksavatdSomwang Souksavatd

          2,5001825




          2,5001825













          • This needs to be higher

            – Jakob Abfalter
            Feb 22 '16 at 14:57



















          • This needs to be higher

            – Jakob Abfalter
            Feb 22 '16 at 14:57

















          This needs to be higher

          – Jakob Abfalter
          Feb 22 '16 at 14:57





          This needs to be higher

          – Jakob Abfalter
          Feb 22 '16 at 14:57











          13
















          $array = array(0 => 100, "color" => "red");
          print_r(array_keys($array));






          share|improve this answer
























          • what's d difference?

            – gumuruh
            Apr 18 '12 at 9:17
















          13
















          $array = array(0 => 100, "color" => "red");
          print_r(array_keys($array));






          share|improve this answer
























          • what's d difference?

            – gumuruh
            Apr 18 '12 at 9:17














          13












          13








          13









          $array = array(0 => 100, "color" => "red");
          print_r(array_keys($array));






          share|improve this answer















          $array = array(0 => 100, "color" => "red");
          print_r(array_keys($array));







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Jul 23 '10 at 11:58









          sushil bharwanisushil bharwani

          16.9k2979118




          16.9k2979118













          • what's d difference?

            – gumuruh
            Apr 18 '12 at 9:17



















          • what's d difference?

            – gumuruh
            Apr 18 '12 at 9:17

















          what's d difference?

          – gumuruh
          Apr 18 '12 at 9:17





          what's d difference?

          – gumuruh
          Apr 18 '12 at 9:17











          5














          If it IS a foreach loop as you have described in the question, using $key => $value is fast and efficient.






          share|improve this answer




























            5














            If it IS a foreach loop as you have described in the question, using $key => $value is fast and efficient.






            share|improve this answer


























              5












              5








              5







              If it IS a foreach loop as you have described in the question, using $key => $value is fast and efficient.






              share|improve this answer













              If it IS a foreach loop as you have described in the question, using $key => $value is fast and efficient.







              share|improve this answer












              share|improve this answer



              share|improve this answer










              answered Jul 23 '10 at 12:17









              DogbertDogbert

              152k28240265




              152k28240265























                  1














                  If you want to be in a foreach loop, then foreach($array as $key => $value) is definitely the recommended approach. Take advantage of simple syntax when a language offers it.






                  share|improve this answer




























                    1














                    If you want to be in a foreach loop, then foreach($array as $key => $value) is definitely the recommended approach. Take advantage of simple syntax when a language offers it.






                    share|improve this answer


























                      1












                      1








                      1







                      If you want to be in a foreach loop, then foreach($array as $key => $value) is definitely the recommended approach. Take advantage of simple syntax when a language offers it.






                      share|improve this answer













                      If you want to be in a foreach loop, then foreach($array as $key => $value) is definitely the recommended approach. Take advantage of simple syntax when a language offers it.







                      share|improve this answer












                      share|improve this answer



                      share|improve this answer










                      answered Jun 5 '15 at 0:22









                      Mike LangMike Lang

                      663




                      663























                          0














                          Another way to use key($array) in a foreach loop is by using next($array) at the end of the loop, just make sure each iteration calls the next() function (in case you have complex branching inside the loop)






                          share|improve this answer




























                            0














                            Another way to use key($array) in a foreach loop is by using next($array) at the end of the loop, just make sure each iteration calls the next() function (in case you have complex branching inside the loop)






                            share|improve this answer


























                              0












                              0








                              0







                              Another way to use key($array) in a foreach loop is by using next($array) at the end of the loop, just make sure each iteration calls the next() function (in case you have complex branching inside the loop)






                              share|improve this answer













                              Another way to use key($array) in a foreach loop is by using next($array) at the end of the loop, just make sure each iteration calls the next() function (in case you have complex branching inside the loop)







                              share|improve this answer












                              share|improve this answer



                              share|improve this answer










                              answered Feb 2 '13 at 23:32









                              B Rad CB Rad C

                              3271516




                              3271516























                                  0














                                  Try this



                                  foreach(array_keys($array) as $nmkey)
                                  {
                                  echo $nmkey;
                                  }





                                  share|improve this answer






























                                    0














                                    Try this



                                    foreach(array_keys($array) as $nmkey)
                                    {
                                    echo $nmkey;
                                    }





                                    share|improve this answer




























                                      0












                                      0








                                      0







                                      Try this



                                      foreach(array_keys($array) as $nmkey)
                                      {
                                      echo $nmkey;
                                      }





                                      share|improve this answer















                                      Try this



                                      foreach(array_keys($array) as $nmkey)
                                      {
                                      echo $nmkey;
                                      }






                                      share|improve this answer














                                      share|improve this answer



                                      share|improve this answer








                                      edited Nov 8 '16 at 11:09

























                                      answered Jun 1 '16 at 12:27









                                      ChamandeepChamandeep

                                      9916




                                      9916






























                                          draft saved

                                          draft discarded




















































                                          Thanks for contributing an answer to Stack Overflow!


                                          • Please be sure to answer the question. Provide details and share your research!

                                          But avoid



                                          • Asking for help, clarification, or responding to other answers.

                                          • Making statements based on opinion; back them up with references or personal experience.


                                          To learn more, see our tips on writing great answers.




                                          draft saved


                                          draft discarded














                                          StackExchange.ready(
                                          function () {
                                          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f3317856%2fphp-get-key-from-array%23new-answer', 'question_page');
                                          }
                                          );

                                          Post as a guest















                                          Required, but never shown





















































                                          Required, but never shown














                                          Required, but never shown












                                          Required, but never shown







                                          Required, but never shown

































                                          Required, but never shown














                                          Required, but never shown












                                          Required, but never shown







                                          Required, but never shown







                                          Popular posts from this blog

                                          404 Error Contact Form 7 ajax form submitting

                                          How to know if a Active Directory user can login interactively

                                          TypeError: fit_transform() missing 1 required positional argument: 'X'