title: PHP Count array index and convert integer to string
body: <p>I got an array taken from an mysqli query, this array contain a list of tasks. I must to count how many tasks is in the array ( so only the number of row ) and put in a icon badge as a human readable number.</p>
  
  <pre><code>     try {
      $db = new PDO("mysql:host=127.0.0.1;dbname=c9", "andreaem_dev", "");
  
      //echo "Connected to database&lt;br/&gt;"; // check for connection
  
      $db-&gt;setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING);
  
      $sql = "SELECT ID FROM data_tasks WHERE data_tasks . user = 'admin'"; //I'm selecting ID so only one element on the row is count
      $result = $db-&gt;query($sql);
      foreach ($result as $row) {
  
              $row = $result-&gt;fetch(PDO::FETCH_NUM);
              echo $row[0];
          }
  
      $db = null; // close the database connection
  
  }
  
  catch(PDOException $e) {
      echo $e-&gt;getMessage();
  }
  </code></pre>
  
  <p>With this code i get a int(2) response, the array contains 5 element and i don't know where it takes '2', even i must to convert it in a number.</p>
  
  <p>Thanks in advice for help!</p>