All pastes #2057701 Raw Edit

Miscellany

public text v1 · immutable
#2057701 ·published 2011-05-13 02:42 UTC
rendered paste body
  $friends_data = $facebook->api('/me/friends/');
     $feed_array = $facebook->api('/me/feed/?limit=50');

     $s = array(); // array of ids and match count? blah
     
     
     foreach($friends_data['data'] as $friend){
     			
     		$s[] = array($friend['id'] => 0);
	  
	}
	echo var_dump($s). '<br>FRIEND ARRAY<br>';
    	for($x=0; $x < count($feed_array['data']);$x++) {
    	
	    	for($y=0;$y < count($feed_array['data'][$x]['comments']['data']); $y++) {
	    	
	    		$from = $feed_array['data'][$x]['comments']['data'][$y]['from']['name'];
	    		$fid = $from = $feed_array['data'][$x]['comments']['data'][$y]['from']['id'];
	    		$msg = $feed_array['data'][$x]['comments']['data'][$y]['message'];
	    		
	    		if(preg_match_all("/lol/i",$msg,$matches)) {
	    		
	    			foreach($matches[0] as $m) {
	    				    			
	    				$num = $s[$fid];
	    				unset($s[$fid]);
	    				$s[$fid] = ($num + 1);	    				    				
	    				
	    			}
	    		} 	    		
	    		  			    			    		
	    	}
    	
    	}
    	unset($s[$me['id']]); 
   	/* this is a script to see how many times lol was said in a comment, for each time lol is found
   	   i will grab the FRIEND_IDs lolcount, unset the friendid/lolcount, add one to the count, 
   	   and then add it to the array again
   	   
   	   i have the array of friend ids and lolcounts already.. but now i have to figur eout how to sort by the LOLCOUNT
   	   to find out what friend ids ahve the most lols, and create a top 10 funniest friends list..
  	   NOW I NEED TO TAKE THE LIST OF ["FRIEND_ID"] => ["LOLCOUNT"]
  	   and sort it by LOLCOUNT DESCENDING, and take the top 10 results form the array
  	   
  	   how the hell do i sort by ['notthisvalue'] => ['_BUT THIS VALUE_']
  	   
  	  
   	*/