DIV CSS 佈局教程網

 DIV+CSS佈局教程網 >> 網頁腳本 >> JavaScript入門知識 >> 關於JavaScript >> PHP 數組current和next用法分享
PHP 數組current和next用法分享
編輯:關於JavaScript     

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';
 ?>

示例很簡單,但是卻很實用,希望小伙伴們能夠喜歡。

XML學習教程| jQuery入門知識| AJAX入門| Dreamweaver教程| Fireworks入門知識| SEO技巧| SEO優化集錦|
Copyright © DIV+CSS佈局教程網 All Rights Reserved