Convert Hex to RGB Color using PHP

sscanf function

<?php

$hexColor = '#8060c2';
[$r, $g, $b] = sscanf($hexColor, '#%02x%02x%02x');

echo $r.','.$g.','.$b;

Leave a Comment

Cancel reply

Your email address will not be published.