How to find the last nested element of a two-dimensional array?
<?php $arr = array( "foo" => "bar", "bar" => "foo", "name" => array(1,2,333), // получить 333 100 => -100 );
How to find the last nested element of a two-dimensional array?
<?php $arr = array( "foo" => "bar", "bar" => "foo", "name" => array(1,2,333), // получить 333 100 => -100 );
Try to write more detailed questions. To get an answer, explain what exactly you see the problem, how to reproduce it, what you want to get as a result, etc. Give an example that clearly demonstrates the problem. If the question can be reformulated according to the rules set out in the certificate , edit it .
You can do the following:
<?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; } }
Source: https://ru.stackoverflow.com/questions/545729/
All Articles