- array_map: documentation ( source)
- str_repeat: documentation ( source)
- implode: documentation ( source)
- str_split: documentation ( source)
<?php
$hexColor = '012';
echo implode('', array_map(function($color){ return str_repeat($color, 2); }, str_split($hexColor)));