includes/functions.php
changeset 346 35b0a72083ca
parent 344 0fa28c5aabe9
equal deleted inserted replaced
345:95d9e7eacc83 346:35b0a72083ca
  1332 /**
  1332 /**
  1333  * Converts a hexadecimal number to a binary string.
  1333  * Converts a hexadecimal number to a binary string.
  1334  * @param text string hexadecimal number
  1334  * @param text string hexadecimal number
  1335  * @return string
  1335  * @return string
  1336  */
  1336  */
       
  1337 if ( !function_exists("hex2bin") ):
  1337 function hex2bin($text)
  1338 function hex2bin($text)
  1338 {
  1339 {
  1339   $arr = enano_str_split($text, 2);
  1340   $arr = enano_str_split($text, 2);
  1340   $ret = '';
  1341   $ret = '';
  1341   for ($i=0; $i<sizeof($arr); $i++)
  1342   for ($i=0; $i<sizeof($arr); $i++)
  1342   {
  1343   {
  1343     $ret .= chr(hexdec($arr[$i]));
  1344     $ret .= chr(hexdec($arr[$i]));
  1344   }
  1345   }
  1345   return $ret;
  1346   return $ret;
  1346 }
  1347 }
       
  1348 endif;
  1347 
  1349 
  1348 /**
  1350 /**
  1349  * Generates and/or prints a human-readable backtrace
  1351  * Generates and/or prints a human-readable backtrace
  1350  * @param bool $return - if true, this function returns a string, otherwise returns null and prints the backtrace
  1352  * @param bool $return - if true, this function returns a string, otherwise returns null and prints the backtrace
  1351  * @return mixed
  1353  * @return mixed