M
M
Maxim Lykov2017-08-24 18:18:22
PHP
Maxim Lykov, 2017-08-24 18:18:22

How to access a single element of an array without knowing its key?

Hello!
Let's say there is a code: How can you deduce this very "value" without resorting to "crutches" like:
$some_array[mt_rand(0, 8)] = 'value';

$some_array[mt_rand(0, 8)] = 'value';
foreach($some_array as $val)  
  echo $val;

?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Ivan Koryukov, 2017-08-24
@evil_q

current($arr) or end($arr)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question