18 lines
288 B
PHP
18 lines
288 B
PHP
<?php
|
|
// Version 3
|
|
|
|
// String functions
|
|
function str2hex($string) {
|
|
return bin2hex($string);
|
|
}
|
|
|
|
function hex2str($integer) {
|
|
if (!preg_match("/^[0-9A-Fa-f]+$/", $integer)) {
|
|
return 'Invalid characters specified';
|
|
} else {
|
|
return hex2bin($integer);
|
|
}
|
|
}
|
|
|
|
?>
|