Created
May 22, 2017 08:40
-
-
Save svenmuennich/3fee5f0e7ba4fa9489fbc9738086c78b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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