Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
次の色が得られたので、PHP で-16777216このようなアルファ 16 進コードに変換したいと考えています。00FFBBCC逆もできるようになりたいです。どこから始めればよいのか本当にわかりません。友達の Google も答えをくれません。
-16777216
00FFBBCC
誰でも助けてくれますか?
ありがとうございました。
dehex() の使用についてはどうですか?
echo dechex(-16777216);
ff000000を出力します
大文字が必要な場合は、単に strtoupper() を使用します。
echo strtoupper(dechex(-16777216)); //FF000000
編集: 逆を行うには、dechex() の代わりに hexdec() を使用します