Advertisement
Guest User

Untitled

a guest
Nov 8th, 2014
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $input1 = array(
  2.   array(
  3.     'context' => 'aa',
  4.     'id' => 1,
  5.     'view' => 1,
  6.     'update' => 1,
  7.   ),
  8.   array(
  9.     'context' => 'bb',
  10.     'id' => 2,
  11.     'view' => 0,
  12.     'update' => 0,
  13.   )
  14. );
  15. $input2 = array(
  16.   array(
  17.     'context' => 'cc',
  18.     'id' => 3,
  19.     'view' => 0,
  20.     'update' => 1,
  21.   ),
  22.   array(
  23.     'context' => 'dd',
  24.     'id' => 4,
  25.     'view' => 0,
  26.     'update' => 0,
  27.   ),
  28.   array(
  29.     'context' => 'ee',
  30.     'id' => 5,
  31.     'view' => 1,
  32.     'update' => 0,
  33.   )
  34. );
  35. $input3 = array(
  36.   array(
  37.     'context' => 'ff',
  38.     'id' => 6,
  39.     'view' => 1,
  40.     'update' => 1,
  41.   ),
  42.   array(
  43.     'context' => 'gg',
  44.     'id' => 7,
  45.     'view' => 1,
  46.     'update' => 0,
  47.   ),
  48. );
  49.  
  50. $global = array($input1, $input2, $input3);
  51.  
  52. foreach ($global as $input) {
  53.  // Do stuff here to generate the output array given below...
  54. }
  55.  
  56. $output = array(
  57.   'aa+1&cc+3&ff+6' => array('view' => 0, 'update' => 1),
  58.   'aa+1&cc+3&gg+7' => array('view' => 0, 'update' => 0),
  59.   'aa+1&dd+4&ff+6' => array('view' => 0, 'update' => 0),
  60.   'aa+1&dd+4&gg+7' => array(...),
  61.   'aa+1&ee+5&ff+6' => array(...),
  62.   'aa+1&ee+5&gg+7' => array(...),
  63.   'bb+2&cc+3&ff+6' => array(...),
  64.   'bb+2&cc+3&gg+7' => array(...),
  65.   'bb+2&dd+4&ff+6' => array(...),
  66.   'bb+2&dd+4&gg+7' => array(...),
  67.   'bb+2&ee+5&ff+6' => array(...),
  68.   'bb+2&ee+5&gg+7' => array(...)
  69. );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement