Basic 1 algorithm:
This algorithm can be ~ Converts the hexadecimal value to the hexadecimal value.
Because recursion is used, an array must be provided as the reference variable during the 10-in-10 => N-in conversion process. Save the Conversion Result
<? Php <br/>/** <br/> * convert to N in decimal format <br/> * @ Param int $ IX The number of 10 hexadecimal values to be converted <br/> * @ Param int $ number between 2-9 in IM format <br/> * @ Param array $ abuf <br/> * @ return void <br/> */ <br/> function K ($ IX, $ im, & $ abuf) <br/>{< br/> if ($ IX> $ IM) <br/> K (floor ($ IX/$ IM ), $ im, $ abuf); <br/> elseif ($ IX = $ IM) <br/> $ abuf [] = '1 '; <br/> $ abuf [] = $ IX % $ im; <br/>}< br/>/** <br/> * convert N-base to decimal <br/> * @ Param string $ SS The N-base number string to be converted <br/> * @ Param int $ number between im-base 2-9 <br/> * @ return int <br/> */<br /> function rk ($ SS, $ IM) <br/>{< br/> $ ilen = strlen ($ SS)-1; <br/> for ($ I = $ ilen; $ I> = 0; $ I --) <br/> $ ibuf + = POW ($ im, $ I) * intval ($ SS {ABS ($ I-$ ilen)}); <br/> return $ ibuf; <br/>}< br/> $ abuf = array (); <br/> $ inhex = 2; // number between 2 and 9 <br/> $ isource = 129; // number of 10 hexadecimal values to be converted <br/> echo "prerequisites: 2 ≤ n ≥ 9. The current value is ". $ inhex. "hexadecimal result;/N"; <br/> K ($ isource, $ inhex, $ abuf); <br/> echo '10 hexadecimal-> N hexadecimal :'. join ('', $ abuf ). "/N"; <br/> echo 'n' hexadecimal-> 10 hexadecimal :'. rk (join ('', $ abuf), $ inhex); <br/>?>
If you want to use it, indicate the source. Thank you.