3v4l.org

run code in 300+ PHP versions simultaneously
<?php echo hex2rgb("CCDDFF"); function hex2rgb($hex) { if (substr($hex,0,1)=="#") $hex=substr($hex, 1); if (strlen($hex)==3) $hex=$hex[0].$hex[0].$hex[1].$hex[1].$hex[2].$hex[2]; elseif (strlen($hex)!=6) return false; $rgb=array(); $rgb[0] = hexdec(substr($hex,0,2)); // red $rgb[1] = hexdec(substr($hex,2,2)); // green $rgb[2] = hexdec(substr($hex,4,2)); // blue return $rgb; } ?>
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
Warning: Array to string conversion in /in/2U3Lr on line 3 Array
Output for 5.4.0 - 5.4.45, 5.5.24 - 5.5.35, 5.6.8 - 5.6.28, 7.0.0 - 7.0.20, 7.1.0 - 7.1.25, 7.2.0 - 7.2.33, 7.3.0 - 7.3.31, 7.4.0 - 7.4.33
Notice: Array to string conversion in /in/2U3Lr on line 3 Array
Output for 5.3.7 - 5.3.29, 7.3.32 - 7.3.33
Array

preferences:
196.45 ms | 402 KiB | 269 Q