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

  • Home
  • SEARCH
  • 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 6346833
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T21:05:40+00:00 2026-05-24T21:05:40+00:00

my question is easy is that … : $arr = array(1, 2, 3, 4,

  • 0

my question is easy

is that … :

$arr = array(1, 2, 3, 4, 5, ..., x); //x is a huge number for the theory

…faster, lower or is it the same speed than :

$arr[] = 1;
$arr[] = 2;
$arr[] = 3;
$arr[] = 4;
$arr[] = 5;
...
$arr[] = x;

?

I think the second way of coding is easy to alter especially if there are multi-dim arrays.
But is this one altering the speed of processing ?

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

    By rough testing, the second method is twice as slow as the first one but unless you are using a very large array (100,000+ elements) or initializing the array a lot of times (1000s of times per second), the difference is negligible.

    For syntactic purposes, refer to Berk’s answer.

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

Sidebar

Related Questions

I think my question is easy. However it is surprising that I couldn't find
First thing i want to say that it's not an easy question to explain,
I am sure this is an easy question, but one that has escaped me
My question seems easy but is little more theoretical than it looks. There are
My question is as easy as that: What is the best method to create
I think it is a question easy to answer, so I'll put it quick:
I know that the question sounds like this is going to be an easy
it seems to me that this is kind of a very easy question, but
Hope that my question is easy enough :) I have BORDER as main container
I have a quite easy jquery question that I can't get right, when clicking

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.