How to find the last input from one of the deposits



  • How do you find the last part of the two-storey mass?

    <?php
    $arr = array(
    
    "foo" =&gt; "bar",
    "bar" =&gt; "foo",
    "name"  =&gt; array(1,2,333), // получить 333
    100   =&gt; -100
    

    );



  • May be as follows:

    <?php
    $arr = array(
        "foo" => "bar",
        "bar" => "foo",
        "name"  => array(1,2,333),
        100   => -100
    );
    foreach($arr as $el) {
      if(is_array($el)) {
        echo end($el);
        break;
      }
    }
    

Log in to reply
 


Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2