title: How can I using a associative array with the url as a key?
body: <p>I use the <a href="https://github.com/joshfraser/rolling-curl/blob/master/RollingCurl.php" rel="nofollow noreferrer">RollingCurl.php</a> from Josh Fraser</p>
  
  <p>At the moment this is the Output from my Skript:
  (The sequence is every time different, because of the loading Speed of each Website.)</p>
  
  <pre><code>array(17) { [0]=&gt; string(6) "Google" [1]=&gt; string(6) "Google" [2]=&gt; string(6) "Google" [3]=&gt; string(6) "Google" [4]=&gt; string(73) "MSN Deutschland | Nachrichten, Sport, Wetter, Hotmail &amp; Outlook Login" [5]=&gt; string(30) "Microsoft - Official Home Page" [6]=&gt; string(8) "��Ѷ��ҳ" [7]=&gt; string(27) "百度一下，你就知道" [8]=&gt; string(44) "WordPress.com: Create a Free Website or Blog" [9]=&gt; string(71) "Blogger.com - Create a unique and beautiful blog. It’s easy and free." [10]=&gt; string(9) "Wikipedia" [11]=&gt; string(33) "Sign in to your Microsoft account" [12]=&gt; string(7) "YouTube" [13]=&gt; string(27) "Featured Content on Myspace" [14]=&gt; string(12) "新浪首页" [15]=&gt; string(12) "Yahoo! JAPAN" [16]=&gt; string(35) "Twitter. Alles, was gerade los ist." }
  </code></pre>
  
  <p>Instant of the numbers I will use the <code>$url</code> as a key to set it to a associative array. 
  Like this:</p>
  
  <pre><code>array(17) { [google]=&gt; string(6) "Google" [msn]=&gt; string(73) "MSN Deutschland | Nachrichten, Sport, Wetter, Hotmail &amp; Outlook Login" ...
  </code></pre>
  
  <p>My Skript: </p>
  
  <pre><code>&lt;?php
  
  $array = [];
  
  // a little example that fetches a bunch of sites in parallel and echos the page title and response info for each request
  function request_callback($response, $info) {
      global $array;
  
      // parse the page title out of the returned HTML
      if (preg_match("~&lt;title&gt;(.*?)&lt;/title&gt;~i", $response, $out)) {
          $array[] = $out[1];
      }
  }
  
  require("RollingCurl.php");
  
  // top 20 sites according to alexa (11/5/09)
  $urls = array("http://www.google.com",
                "http://www.facebook.com",
                "http://www.yahoo.com",
                "http://www.youtube.com",
                "http://www.live.com",
                "http://www.wikipedia.com",
                "http://www.blogger.com",
                "http://www.msn.com",
                "http://www.baidu.com",
                "http://www.yahoo.co.jp",
                "http://www.myspace.com",
                "http://www.qq.com",
                "http://www.google.co.in",
                "http://www.twitter.com",
                "http://www.google.de",
                "http://www.microsoft.com",
                "http://www.google.cn",
                "http://www.sina.com.cn",
                "http://www.wordpress.com",
                "http://www.google.co.uk");
  $rc = new RollingCurl("request_callback");
  $rc-&gt;window_size = 20;
  foreach ($urls as $url) {
      $request = new RollingCurlRequest($url);
      $rc-&gt;add($request);
  }
  $rc-&gt;execute();
  
  var_dump($array);
  ?&gt;
  </code></pre>