Home > Article > Backend Development > PHP array function current and next usage sharing
This article gives you a simple comparative analysis of the usage of PHP arrays current and next through examples. Although the example is very simple, it is very helpful for us to understand current and next. It is recommended to everyone here.
1.current
<?php $transport = array('foot', 'bike', 'car', 'plane'); $mode = current($transport); //$mode = 'foot'; $mode = next($transport); // $mode ='bike'; $mode = current($transport); //$mode = 'bike'; $mode = prev($transport); // $mode ='foot'; $mode = end($transport); // $mode ='plane'; $mode = current($transport); //$mode = 'plane'; ?>
2.next
a8697d447d72e01f079d4485d53affce
The example is very simple, but very practical. I hope your friends will like it.
The above has introduced the usage sharing of PHP array current and next, including the content of current and next. I hope it will be helpful to friends who are interested in PHP tutorials.