0

I have a switch with 100 cases which I have to go through. So I was wondering that which approach will have less space complexity.

This question

In PHP what's faster, big Switch statement, or Array key lookup

somewhat answers the time complexity but they did not take into account the memory factor.

Alive to die - Anant
  • 70,531
  • 10
  • 51
  • 98
Watan
  • 11
  • 1
  • This is really broad. – nerdlyist May 09 '18 at 12:36
  • 1
    Is there any reason that you cannot reproduce the knowledge from https://stackoverflow.com/q/6852652/2191572 and use [`memory_get_usagee()`](http://php.net/manual/en/function.memory-get-usage.php) to figure out the rest of whatever you are asking? – MonkeyZeus May 09 '18 at 12:39
  • What is the memory factor you are worries about anyways? 100 cases on today's hardware is meh at best. – nerdlyist May 09 '18 at 12:48

0 Answers0