Skip to content

Instantly share code, notes, and snippets.

@kirkegaard
Created November 15, 2011 19:17
Show Gist options
  • Save kirkegaard/1368025 to your computer and use it in GitHub Desktop.
Save kirkegaard/1368025 to your computer and use it in GitHub Desktop.
holmans spark in php
#!/usr/bin/env php
<?php
$ticks = array('','','','','','','');
$args = explode(',', (($argv[1] == '--stdin') ? fgets(fopen('php://stdin', 'r'), 1024) : $argv[1]));
$range = (max($args) - min($args)) + 1;
array_map(function($val) use ($ticks, $args, $range) {
print $ticks[round((($val - min($args)) / $range) * (count($ticks) - 1))];
}, $args);
print "\n";
@md2perpe
Copy link

I think that you could change to

$ticks = '▁▂▃▄▅▆▇';

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment