Jump to content

Fast way to make a big array?


Azu

Recommended Posts

On some pages on my site, I need to make a big array.

 

The problem is this;

the total time of running all the PHP on the page is about 12ms, and without the variable it is about 5ms. So it's making it take over twice as long.

Is there a way to create the array faster?

 

I'm basically doing it like this right now

$array=array(

'ab'=>array('ab'=>'blah',5=>'foo','xx'=>'bar',9=>'moooo','cd'=>'blah blah blah',7=>'test(abc)'),

(about 200 or so of these)

)

Link to comment
https://forums.phpfreaks.com/topic/77612-fast-way-to-make-a-big-array/
Share on other sites

Basically the main arrays are 2 letter strings and the sub arrays are a mix of 2 letter strings and 1 to 2 number integers that are set to strings of usually between 1 and 3 words

 

 

$array=array(

 

'aa'=>array('ab'=>'Blah blah',3=>'Some words','xy'=>'A little sentence',27=>'BLAH'),

'wx'=>array(99=>'Foo',12=>'Bar','lm'=>'Doo dee doo','hi'=>'La de la','5=>'Another string'),

etc (about 200 of these)

 

);

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.