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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T16:33:44+00:00 2026-05-15T16:33:44+00:00

In java and C++ when we don’t know the size – array not used

  • 0

In java and C++ when we don’t know the size – array not used like in PHP, instead used linkedList etc.

In PHP exist SPL, but most of the times programmers use array, why (because people don’t know about SPL )?

When we should use Array in PHP and whenSPL and what is the difference in this case between PHP and Java/C++?

  • 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-15T16:33:44+00:00Added an answer on May 15, 2026 at 4:33 pm

    Every PHP request must initialize all variables and after request they are freed. Because of that not often comes situations where special data structures (like maxheap, linkedlist or queue) are more efficient than array.
    Also arrays are much simpler to understand and use for beginner.

    Difference from C++ in PHP is that arrays length is dynamic. You can add elements whenever you want.

    $arr=array();
    $arr[]=5; //add integer to array
    echo count($arr); //1
    $arr[]=7;
    echo count($arr); //2
    

    you can dynamically create and add array to another array

    $arr[]=array();
    $arr[2][]=5;
    echo count($arr); //3
    echo count($arr[2]); //1
    

    This will create new array, add element with value 5 and add it as element to array $arr.

    $arr[][]=5;
    

    In PHP arrays are hash tables, so you can have not only integer keys but also strings:

    $arr['somekey']='somevalue';
    

    If array element is integer then each element requires a value structure (zval) which takes 16 bytes. Also requires a hash bucket – which takes 36 bytes. That gives 52 bytes per value. Memory allocation headers take another 8 bytes*2 – which gives 68 bytes.

    About arrays in PHP: http://oreilly.com/catalog/progphp/chapter/ch05.html

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

Sidebar

Ask A Question

Stats

  • Questions 543k
  • Answers 543k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer SSMS tools pack (free) has snippets which may do what… May 17, 2026 at 6:16 am
  • Editorial Team
    Editorial Team added an answer Most browsers will explicitely deny this. Doing a cross server… May 17, 2026 at 6:16 am
  • Editorial Team
    Editorial Team added an answer As Jim Mische and Steven Sudit pointed out it may… May 17, 2026 at 6:16 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

I'd like to to something like the following in Java and don't really know
GWT seems like a really nice technology for Java developers who don't like (or
A Java version of this question was just answered, and, well, I don't know
The java.lang.RuntimeException is Don't call setOnClickListener for an AdapterView. You probably want setOnItemClickListener instead,
Many Java Apps don't use anti-aliased fonts by default, despite the capability of Swing
I'm looking around for a Java code signing certificate so my Java applets don't
In Java, arrays don't override toString() , so if you try to print one
I want to use the java.util.Preferences API but I don't want my program to
Is there a destructor for Java? I don't seem to be able to find
In java, I could do this with the 'final' keyword. I don't see 'final'

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.