The first one is definitely something that works, but which one below is the efficient way?
switch($type) { case 1: print 'success'; break; case 2: print 'success'; break; case 3: print 'success'; break; case 4: print 'success for type 4'; break; }
Since 1, 2 and 3 print do the same, can I do this?
switch($type) { case 1, 2, 3: print 'success'; break; case 4: print 'success for type 4'; break; }
or
switch($type) { case 1: case 2: case 3: print 'success'; break; case 4: print 'success for type 4'; break; }
Is the way to go!