Skip to content

Instantly share code, notes, and snippets.

@haskellcamargo
Last active August 29, 2015 14:22
Show Gist options
  • Select an option

  • Save haskellcamargo/1ae86fbf0b854158bf01 to your computer and use it in GitHub Desktop.

Select an option

Save haskellcamargo/1ae86fbf0b854158bf01 to your computer and use it in GitHub Desktop.
HOLY SHIT DON'T USE THIS WORKAROUND
<?php
/**
* @package unilsc
* @author Marcelo Camargo
* @since 2015/06/08
* @license GNU GPL v3
* P.S.: NMTBR => Not Meant To Be Readable.
*/
ini_set('display_startup_errors',1);
ini_set('display_errors',1);
error_reporting(-1);
function unilsc($source) {
$replacement_table = [
"→" => "->"
];
list ($primary, $secondary) = [[], []];
foreach ($replacement_table as $key => $value) {
$primary[] = $key;
$secondary[] = $value;
}
return str_replace($primary, $secondary, $source);
}
try {
# unilsc file_name output_to get_from
$file = $argv[1];
if (file_exists($file)) {
echo unilsc(file_get_contents($file));
} else {
throw new Exception("Fatal error: file unacessible\n");
}
} catch (Exception $e) {
echo $e->getMessage();
exit;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment