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
<?php $transport = array('foot', 'bike', 'car', 'plane'); $mode = current($transport); //$mode = 'foot'; $mode = next($transport); // $mode ='bike'; $mode = next($transport); // $mode ='car'; $mode = prev($transport); // $mode ='bike'; $mode = end($transport); // $mode ='plane'; ?>
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.