title: PHP Closure Object
body: <p>I am trying to generate lat and long cordinates for about a 1000+ locations, I know how to get them in a range and everything but I was wondering if I can do something like this. </p>
  
  <pre class="lang-php prettyprint-override"><code>for ($i = 0; $i &lt; 10; $i++) {
      $lat = function () {
          $float = rand(0, 99999) / 99999;
          $lat = rand(30, 32);
          $lat = $lat + $float;
          return $lat;
      };
      $long = function () {
          $float = rand(0, 99999) / 99999;
          $long = rand(74, 76);
          $long = $long + $float;
          return $long;
      };
      print_r($lat);
  }
  </code></pre>
  
  <p>The code didn't throw the desired result instead, I'm getting </p>
  
  <pre><code>closureObject()
  </code></pre>
  
  <p>There's no error but I can't seem to get it to work, any help would be wonderful, I've tried reading the documentation but doesn't explain anything related to this. </p>
  
  <p>Can this work?</p>