php array current

Solutions on MaxInterview for php array current by the best coders in the world

showing results for - "php array current"
Simona
29 May 2020
1
2<?php
3$transport array('foot''bike''car''plane');
4$mode = current($transport); // $mode = 'foot';
5$mode = next($transport);    // $mode = 'bike';
6$mode = current($transport); // $mode = 'bike';
7$mode = prev($transport);    // $mode = 'foot';
8$mode = end($transport);     // $mode = 'plane';
9$mode = current($transport); // $mode = 'plane';
10
11$arr array();
12var_dump(current($arr)); // bool(false)
13
14$arr array(array());
15var_dump(current($arr)); // array(0) { }
16?>
17
18