I have googled and used various approaches from this site, but somehow my problem isn't getting resolved.
Here is my problem: I have an array named $color and I want to add arrays into this (multidimensional) array, from within a function.
$color = array();
function hex2RGB($hex){
$hex = ltrim($hex,'#');
$a = hexdec(substr($hex,0,2));
$b = hexdec(substr($hex,2,2));
$c = hexdec(substr($hex,4,2));
$rgb = array($a, $b, $c);
array_push($color,$rgb);
}
hex2RGB("#97B92B");
hex2RGB("#D1422C");
hex2RGB("#66CAEA");
I know the function creates a good "rgb"-array with 3 values, I tested with screen output. But using array_push or $color[] = $rgb; doesn't add that array to the $color array. No error is shown, the "color"-array just stays empty.
returnon the end and assign it