Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1113473
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T02:51:47+00:00 2026-05-17T02:51:47+00:00

PHP.net ‘s documentation on the range function is a little lacking. These functions produce

  • 0

PHP.net‘s documentation on the range function is a little lacking. These functions produce unexpected (to me anyways) results when given character ranges.


$m = range('A','z');
print_r($m);
$m = range('~','"');
print_r($m);

I’m looking for a reference that might explicitly define its behavior.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T02:51:48+00:00Added an answer on May 17, 2026 at 2:51 am

    The issue is that range treats its arguments like integers, and if you give it a single character it will convert it to its ASCII character code.

    In the first case, you’re getting all characters between character ‘A’ (integer 65) and character ‘z’ (integer 122). This is expected behavior for those of us coming from a C (or C-like language) background.

    This is one of the rare cases where PHP converts single characters to their ASCII codes rather than parsing the string as integer the way it does normally. Most of the PHP documentation is better at telling you when to expect this. strpos for example, notes:

    Needle

    If needle is not a string, it is converted to an integer and applied as the ordinal value of a character.

    The documentation for range is strangely quiet about it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Given this example taken from http://php.net/manual/en/function.crypt.php crypt('rasmuslerdorf', '$2a$07$usesomesillystringforsalt$') Firstly: What is the length that
http://php.net/manual/en/function.mcrypt-module-open.php <?php $td = mcrypt_module_open(MCRYPT_DES, '', MCRYPT_MODE_ECB, '/usr/lib/mcrypt-modes'); $td = mcrypt_module_open('rijndael-256', '', 'ofb', '');
http://php.net/manual/en/function.trim.php The manual entry does say that I can remove any specified leading or
The function signature on PHP.net for array_replace() says that the arrays will be passed
The documentation on php.net is very spotty about causes of failure for APC writes.
According to: http://www.php.net/manual/en/function.filectime.php In most Unix filesystems, a file is considered changed when its
From PHP.net: http://www.php.net/manual/en/function.pfsockopen.php I understand the gist of what this function accomplishes, but I'm
From http://php.net/manual/en/function.mcrypt-encrypt.php , I saw the following codes using AES with an IV in
So I found a function from http://php.net/manual/en/function.exec.php function execInBackground($cmd) { if (substr(php_uname(), 0, 7)
I've tried this: http://be.php.net/manual/en/function.mysql-list-fields.php , but there's too much detail here. What I'm looking

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.