PHP/Data Structure/Array range

Материал из Web эксперт
Перейти к: навигация, поиск

range(0,20,2)

<?php
   $even = range(0,20,2);
   // $even = array(0,2,4,6,8,10,12,14,16,18,20);
   print_r($die);
?>



range: A--F

<?php
   $letters = range("A","F");
   // $letters = array("A,","B","C","D","E","F");
   print_r($letters);
?>



range: Create an array containing a range of elements

<?php
   $die = range(0,6);
   // Same as specifying $die = array(0,1,2,3,4,5,6)
   print_r($die);
?>