Skip to content

Instantly share code, notes, and snippets.

@svenmuennich
Created May 22, 2017 08:40
Show Gist options
  • Save svenmuennich/3fee5f0e7ba4fa9489fbc9738086c78b to your computer and use it in GitHub Desktop.
Save svenmuennich/3fee5f0e7ba4fa9489fbc9738086c78b to your computer and use it in GitHub Desktop.
<?php
$referencingTableName = 's_plugin_viison_address_label_dispatch_configuration';
$referencingColumnName = 'dispatchId';
$prefix = 'fk';
$maxSize = 30;
$hash = implode('', array_map(function ($column) {
return dechex(crc32($column));
}, [
$referencingTableName,
$referencingColumnName
]));
echo substr(strtoupper($prefix . '_' . $hash), 0, $maxSize);
echo "\n";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment