includes/functions.php
changeset 1355 12c23b83c79d
parent 1341 90e2064c8ea2
child 1357 4f83d730633f
child 1370 24f5610ea589
--- a/includes/functions.php	Sun Sep 18 02:13:34 2011 -0400
+++ b/includes/functions.php	Fri Dec 02 01:15:55 2011 -0500
@@ -1535,20 +1535,24 @@
 	return $ret;
 }
 
-/**
- * Converts a hexadecimal number to a binary string.
- * @param text string hexadecimal number
- * @return string
- */
-function hex2bin($text)
+if ( !function_exists('hex2bin') )
 {
-	$arr = enano_str_split($text, 2);
-	$ret = '';
-	for ($i=0; $i<sizeof($arr); $i++)
-	{
-		$ret .= chr(hexdec($arr[$i]));
-	}
-	return $ret;
+	/**
+	 * Converts a hexadecimal number to a binary string.
+	 * Enclose in an if(function_exists()) due to a builtin named hex2bin being added in PHP 5.4.x.
+	 * @param text string hexadecimal number
+	 * @return string
+	 */
+	function hex2bin($text)
+	{
+		$arr = enano_str_split($text, 2);
+		$ret = '';
+		for ($i=0; $i<sizeof($arr); $i++)
+		{
+			$ret .= chr(hexdec($arr[$i]));
+		}
+		return $ret;
+	}
 }
 
 /**