title: How to Convert stdClass object to int in PHP
body: <p>I want to search into my database with user_id and get the amount value(int type)</p>
  
  <pre><code>$user = (int)(request('user'));
      $money = (int)(request('money'));
      $data = (DB::select("select amount from user_check where user_id = '$user'"));
      $array = json_decode(json_encode($data), True);
      foreach ($data as $value) 
      {
          $array[] = $value-&gt;amount;
      } 
      if($array[0]&gt;$money)
      {
          return response(['user ok'=&gt;$array[0],'money'=&gt;$money]);
      }
      else
      {
          //return response(['user'=&gt;$user,'Not enough money'=&gt;$data]);
          return response('user not ok');
      }
  </code></pre>
  
  <p>but it doesn't work, it always going into the if nomather how big the $money is</p>