Skip to content

Instantly share code, notes, and snippets.

@nathggns
Last active August 29, 2015 14:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nathggns/c4dd0089aaef2bec35ce to your computer and use it in GitHub Desktop.
Save nathggns/c4dd0089aaef2bec35ce to your computer and use it in GitHub Desktop.
<?php
$json = file_get_contents('https://gist.githubusercontent.com/nathggns/051203c3d7e72159de0d/raw/9e368d3a99a219a7fc487d327b86ebd4f6c8ed53/results.json') or die('Cannot fetch data');
$consts = json_decode($json, true) or die('Cannot decode data');
echo array_reduce(array_values($consts), function($amount, $parties) {
return $amount + ($parties[0]['share'] < 0.5 ? 1 : 0);
}, 0);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment