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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T21:55:39+00:00 2026-05-29T21:55:39+00:00

I have a question that I cannot find an answer. I’m constructing a very

  • 0

I have a question that I cannot find an answer.

I’m constructing a very big array that contain hex values of a file (like $array[0]=B5 $array[1]=82 and so on until $array[1230009])

When I create a function to manipulate some offsets in that array and pass the $array as reference ( function parse(&$array) { ... }) it takes WAY longer than if I pass the array normaly ( function parse($array) { ... }) ..

How is that possible ?

PS: Is there any faster way not to use array at all ? Just to use a $string = “B5 82 00 1E ..etc”, but I need to track the Offset as i advance in reading hex values as some of this values contains lengths”

  • 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-29T21:55:42+00:00Added an answer on May 29, 2026 at 9:55 pm

    There are some informations that might help in the following article : Do not use PHP references

    Close to the end of that post, Johannes posts the following portion of code (quoting) :

    function foo(&$data) {
        for ($i = 0; $i < strlen($data); $i++) {
            do_something($data{$i});
        }
    }
    
    $string = "... looooong string with lots of data .....";
    foo(string);
    

    And a part of the comment that goes with it is (still quoting) :

    But now in this case the developer tried to be smart and save time by
    passing a reference.
    But well, strlen() expects a copy.

    copy-on-write can’t be done on references so $data will be
    copied for calling strlen(), strlen() will do an absolutely simple
    operation – in fact strlen() is one of the most trivial functions
    in PHP –
    and the copy will be destroyed immediately.

    You might well be in a situation like this one, considering the question you are asking…

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

Sidebar

Related Questions

I have a relatively simple question that I cannot seem to find the answer
I have a question that is probably very simple, but I cannot find an
I would have another question I cannot find answer on. I know that the
I have a very simple question but cannot find a simple answer. I have
I have a really simple question that I cannot find a straightforward answer for.
I have a question which I cannot find an answer to. I'm experimenting with
HI, I have a question but cannot find the answer for a long time,
Just small question as I cannot find an answer that resolves my problem. I
This is a beginner's question but for some reason I cannot find the answer
I have what i thought was a relatively simple question but i cannot find

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.