title: Creating Unique Array Pairs In PHP
body: <p>I came across a kind of a puzzle today during my coding.
  I wanted to share and get help from you.</p>
  <p>I make a query in to the MySql Database and get results as in an array.
  So I have an output like this:</p>
  <pre><code> $rows=array(n) { // for each n value elements can have different values
      [&quot;val1&quot;] =&gt; string(3) &quot;abc&quot;
      [&quot;val2&quot;] =&gt; string(3) &quot;def&quot;
      [&quot;val3&quot;] =&gt; string(3) &quot;ghi&quot;
      [&quot;val4&quot;] =&gt; string(3) &quot;jkl&quot;
  }
  </code></pre>
  <p>So let's say n=4 for instance and i need to create unique pairs that same numbers of pair do not occur in the queue.<br />
  What I need is as in the example:</p>
  <pre><code>n= 1, 2, 3, 4
  </code></pre>
  <p>Pairs I need to get:</p>
  <pre><code>1-2, 1-3, 1-4, 2-3, 2-4, 3-4
  </code></pre>
  <p>I need to avoid the pairs like <code>2-1. 3-1, 4-1, 3-2, 4-2, 4-3 and 1-1, 2-2, 3-3, 4-4</code>.<br />
  For Every Pair, I will Check if this pair of arrays are equal.<br />
  How can I do that?</p>