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
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)

 

);

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.