[Single topic]range (' A ', ' Z ') return what?

Source: Internet
Author: User

  1. The call to this function throws an exception
  2. false
  3. A to Z in alphabetical order
  4. The distance between A and z in the alphabet
PHP Range () function

PHP Array function

Instance

Create an array containing the range of elements from "0" to "5":

range(0,5);p Rint_r ();? >

Running an instance

Definition and usage

The range () function creates an array of elements that contain the specified range.

The function returns an array containing the elements from low to high.

Note: If the low parameter is greater than the high parameter, the created array will be from high to low.

Description

The function creates an array that contains integers or characters from low to high ( containing low and high). If High is smaller than low, returns an array of the inverse order.

Grammar
Range (low,High,step)
Parameters Description
Low Necessary. Specifies the lowest value of the array.
High Necessary. Specifies the highest value of the array.
Step Optional. Specifies the stepping between elements. The default is 1.
Technical details
return value: Returns an array containing the elements from low to high.
PHP version: 4 +
Update log:

The step parameter is added in PHP 5.0.

in PHP 4.1.0 to 4.3.2, the function considers a numeric string as a string instead of an integer. Numeric strings will be used for character sequences, for example, "5252" is considered "5".

Support for character sequences and decrement arrays is new in PHP 4.1.0. The value of the character sequence is limited to one length. If the length is greater than one, only the first character is used. Before this version, range () only produces an incremented array of integers.

More examples of examples 1

Returns an array of elements that contain "0" through "50" and increment by 10:

range(0,50,10);p Rint_r ();? >

Running an instance

Example 2

Use letters-Returns an array containing elements from "a" to "D":

range("a","d");p Rint_r ($letter);? >

Running an instance

[Single topic]range (' A ', ' Z ') return what?

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.