includes/functions.php
changeset 1355 12c23b83c79d
parent 1341 90e2064c8ea2
child 1357 4f83d730633f
child 1370 24f5610ea589
equal deleted inserted replaced
1354:eecde44145eb 1355:12c23b83c79d
  1533 		$ret[] = substr($text, $i, $inc);
  1533 		$ret[] = substr($text, $i, $inc);
  1534 	}
  1534 	}
  1535 	return $ret;
  1535 	return $ret;
  1536 }
  1536 }
  1537 
  1537 
  1538 /**
  1538 if ( !function_exists('hex2bin') )
  1539  * Converts a hexadecimal number to a binary string.
  1539 {
  1540  * @param text string hexadecimal number
  1540 	/**
  1541  * @return string
  1541 	 * Converts a hexadecimal number to a binary string.
  1542  */
  1542 	 * Enclose in an if(function_exists()) due to a builtin named hex2bin being added in PHP 5.4.x.
  1543 function hex2bin($text)
  1543 	 * @param text string hexadecimal number
  1544 {
  1544 	 * @return string
  1545 	$arr = enano_str_split($text, 2);
  1545 	 */
  1546 	$ret = '';
  1546 	function hex2bin($text)
  1547 	for ($i=0; $i<sizeof($arr); $i++)
  1547 	{
  1548 	{
  1548 		$arr = enano_str_split($text, 2);
  1549 		$ret .= chr(hexdec($arr[$i]));
  1549 		$ret = '';
  1550 	}
  1550 		for ($i=0; $i<sizeof($arr); $i++)
  1551 	return $ret;
  1551 		{
       
  1552 			$ret .= chr(hexdec($arr[$i]));
       
  1553 		}
       
  1554 		return $ret;
       
  1555 	}
  1552 }
  1556 }
  1553 
  1557 
  1554 /**
  1558 /**
  1555  * Generates and/or prints a human-readable backtrace
  1559  * Generates and/or prints a human-readable backtrace
  1556  * @param bool $return - if true, this function returns a string, otherwise returns null and prints the backtrace
  1560  * @param bool $return - if true, this function returns a string, otherwise returns null and prints the backtrace