title: Compare two JSON in PHP
body: <p>Here is my code in PHP,</p>
  
  <pre><code>&lt;?php
  $query = "SELECT items FROM `ppmp` ORDER BY date DESC LIMIT 1";
    if($result2 = $con-&gt;query($query)) {
     $row = $result2-&gt;fetch_array();
    $items2 = $row['items'];
   }
   $items = $_POST['ris4'];
   $items = json_decode($items,true);
   $items2 = json_decode($items2,true);
  
  for($i = 0; $i &lt; sizeOf($items["items"]);$i++){
  for($i2 = 0; $i2 &lt; sizeOf($items2["items"]); $i2++){
      $val = $items["items"][$i]["Desc"];
      $val2 = $items2["items"][$i2]["Desc"];
      print_r($val);
      print_r($val2);
      if(strcmp($val, $val2) == 0){
       echo "same";
      }
  }
  }
  ?&gt;
  </code></pre>
  
  <p>I am going to substract the Quantity of the products.. 
  But i can't detect if the two descriptions is the same..</p>
  
  <p>I use <code>strcmp()</code> but it is not working.. i echoed descriptions and it's have same descriptions. but <code>==</code> operator is not working.</p>
  
  <p>This is the layout of the <code>$items2</code> JSON,</p>
  
  <pre><code>{"items":[{"Desc":" Pencil ","Qty":25},{"Desc":" Ballpen ","Qty":5},{"Desc":" Tech Pen ","Qty":20}]}
  </code></pre>
  
  <p>And here is the <code>$items</code>,</p>
  
  <pre><code>{"items":[{"Desc":" Tech Pen ","Qty":15},{"Desc":" Ballpen ","Qty":4}]}
  </code></pre>