How many number of elements can an array in PHP hold? like 300? 10000? or
10000000000000000000000000000000000000000000000000000000 ???

Recommended Answers

I dont' think there is a limit: http://www.php.net/manual/en/language.types.array.php
but consider: an array can contain strings and/or ints, a string max lenght is ~2GB, the int limit is platform dependent, default is two billions.

Jump to Post

All 2 Replies

I dont' think there is a limit: http://www.php.net/manual/en/language.types.array.php
but consider: an array can contain strings and/or ints, a string max lenght is ~2GB, the int limit is platform dependent, default is two billions.

So the array will probably be limited by the memory_limit in php.ini or by the amount of RAM.

string: http://www.php.net/manual/en/language.types.string.php
int: http://php.net/manual/en/language.types.integer.php

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.20 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.