fork download
  1. <?php
  2.  
  3. $rgb = "80, 120, 150";
  4.  
  5. function getColor($colors){
  6. $redGreenBlue=array();
  7. $var = preg_split('/[\s, ]+/', $colors);
  8.  
  9. foreach($var as $value){
  10. $redGreenBlue[] = $value;
  11. }
  12.  
  13. return $redGreenBlue;
  14. }
  15.  
  16. var_dump(getColor($rgb));
Success #stdin #stdout 0.01s 20520KB
stdin
Standard input is empty
stdout
array(3) {
  [0]=>
  string(2) "80"
  [1]=>
  string(3) "120"
  [2]=>
  string(3) "150"
}