1

I have a php associative array which contains more approximately 900 key-value and i am using it as a string file. The problem is now when I add another key-value , I am unable to retrieve the value by key. How ever if i delete some other key-value it works fine. I wonder if there is any size limit for array. Please help me, i don't want to split my array into different files. Thank you in advance. This is what y string file looks like

function lang($phrase){
static $lang = array(   
't_sust_tour'=>'tour',
'process_report'=>'p report '
);
return $lang[$phrase];
}
6
  • 1
    heard of databases? however 900 is no where near the limit Commented Aug 22, 2015 at 5:33
  • 1
    Give us an mcve Commented Aug 22, 2015 at 5:34
  • Ya but i don't want to use database. And if it is not near the limit than why i am unable to retrieve the value? I just get a blank value whenever i call array by key Commented Aug 22, 2015 at 5:35
  • show us some code and we may be able to answer this Commented Aug 22, 2015 at 5:36
  • Please post some more code. You have 900 elements in this function by adding all the elements to the array staticly? Anyway, before you return check that the index is isset: if (isset($lang[$phrase])) { return $lang[$phrase] } else { echo "Not isset: " . $phrase; exit; } And please test it with some index that does not work. Maybe something wrong with your indexes. Commented Aug 22, 2015 at 5:47

1 Answer 1

-1

There is no max or limit, but it is how much memory your script will consume which can be adjusted in the 'memory_limit' in your php.ini configuration.

here is answer from a previous SO post Array size limit in PHP

Sign up to request clarification or add additional context in comments.

3 Comments

As far as I read on SO and some-other forums the only limit is the memory_limit setting in php.ini that can be changed. why the down vote by the way?
please provide an explanation and a reason for down voting my answer.
Well, i did not down voted. I hav'nt ear that reputation to do so

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.