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 6114925
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T15:01:56+00:00 2026-05-23T15:01:56+00:00

As many of you already know, PHP 5.4 alpha has been released. I have

  • 0

As many of you already know, PHP 5.4 alpha has been released. I have a question regarding the following.

Simplified string offset reading.
$str[1][0] is now a legal construct.

How exactly does $str[1][0] work?

EDIT: http://php.net/releases/NEWS_5_4_0_alpha1.txt

  • 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-23T15:01:57+00:00Added an answer on May 23, 2026 at 3:01 pm

    This is a side effect, and was mentioned in the proposal here:
    http://php.markmail.org/thread/yiujwve6zdw37tpv

    The feature is speed/optimization of string offsets.

    Hi,

    Recently I noticed that reading of
    string offset is performed in two
    steps. At first special string_offset
    variant of temporary_variable is
    created in
    zend_fetch_dimension_address_read()
    and then the real string value is
    created in
    _get_zval_ptr_var_string_offset().

    I think we can create the real string
    in the first place. This makes 50%
    speed-up on string offset reading
    operation and allows to eliminate some
    checks and conditional brunches in VM.

    The patch is attached (don’t forget to
    regenerate zend_vm_execute.h to test
    it). However it changes behavior in
    one bogus case. The following code now
    will emit “b” (currently it generates
    a fatal error – cannot use string
    offset as an array).

    $str = "abs";
    var_dump($str[1][0]);
    

    I think it’s not a problem at all. “b”
    makes sense because “abs”[1] -> “b”
    and “b”[0] -> “b”.

    I’m going to commit the patch in case
    of no objections.

    Thanks. Dmitry.

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

Sidebar

Related Questions

As many of you may already know I have been having issues with another
I know this kind of questions have been asked already many times before. The
I know this question has been asked many times before, but I haven't found
There have been many debates about this topic already here, but none of them
I know many of you will think that my questions been already asked and
I know that this question might have been asked like 100 times, but, believe
I know that many has been ask for how to create a SMS server,
I know there have been many questions asking for help converting URLs to clickable
I know there are already many questions like mine but I found no answer
First of all: I do know that there are already many questions and answers

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.