Home  >  Article  >  Backend Development  >  Can sprintf convert hexadecimal to decimal?

Can sprintf convert hexadecimal to decimal?

WBOY
WBOYOriginal
2016-08-23 09:17:532720browse

echo sprintf("%x","10");
a
Complete the conversion from decimal to hexadecimal;

Can sprintf convert hexadecimal to decimal?
Don’t want to use base_convert function.
echo base_convert('a',16,10);
10

Reply content:

echo sprintf("%x","10");
a
Complete the conversion from decimal to hexadecimal;

Can sprintf convert hexadecimal to decimal?
Don’t want to use base_convert function.
echo base_convert('a',16,10);
10

<code>echo sprintf("%d", 0x00FF);</code>
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn