title: how to version_compare each array value in php?
body: <p>I have two arrays I need to compare with the operator <code>&lt;=</code>. I thought an easy way to try and do this is using <code>version_compare</code> but I'm not sure that A. This is best method and B. It's actually comparing the right values.</p>
  
  <p>In order for version_compare to work I implode the array.</p>
  
  <pre><code>//Original arrays.
  
  a$ = array( 0 =&gt; "ajax dropdown0.1.5", 1 =&gt; "hello dolly1.6", 2 =&gt; "test4.5");
  b$ = array( 0 =&gt; "ajax dropdown0.1.4", 1 =&gt; "hello dolly1.6", 2 =&gt; "test4.6");
  
  //implode into string
  
  $a_implode = implode( "," , $a );
  $b_implode = implode( "," , $b );
  
  //compare version
  
  if (version_compare($a_implode, $b_implode, '&lt;=')){
                      echo 'We have a problem';
                      }
  </code></pre>
  
  <p>This seems to work but I have no idea if it's actually comparing the correct values, for instance test4.5 must only be compared to test4.6 ( and not the other string values), also I am unsure how to output any matches if version_compare returns true.</p>