title: How to output Simple Array Sum challenge of HackerRank in PHP?
body: <p>I was just trying to get familiar with HackerRank environment and practice some problems. </p>
  
  <p>I was attempting its 2nd challenge in Algorithms>Warmups:
  <a href="https://www.hackerrank.com/challenges/simple-array-sum" rel="nofollow">Simple Array Sum</a></p>
  
  <p>I have solved it and its working fine on my local machine.</p>
  
  <pre><code>Code:
  &lt;?php
  
  function testSum($n,$x)
  {
     $sum=0;  
     $x =explode(" ",$x);
      for($i=0;i&lt;$n;$i++)  
          {  
          $sum+=$x[$i];  
      }  
      echo $sum;
  }
  $handle = fopen ("php://stdin","r");
  fscanf($handle,"%d",$n);
  $arr_temp = fgets($handle);
  $arr = explode(" ",$arr_temp);
  array_walk($arr,'intval');
  
  ?&gt;
  </code></pre>
  
  <p>But It keeps giving me same response every time:
  <a href="http://i.stack.imgur.com/Pmuox.png" rel="nofollow">Response on running code.</a></p>
  
  <p>Please help me how to print results in hackerrank and what am I missing here. Thanks</p>