fork download
  1. <?php
  2.  
  3. $array = array('8:16', '9:8', '10:11', '11:5', '12:5', '13:13', '14:42');
  4.  
  5. foreach($array as $key => &$val)
  6. $val = preg_replace('/\d+:(\d+)/', $key.':$1', $val);
  7.  
  8. print_r($array);
Success #stdin #stdout 0.01s 20568KB
stdin
Standard input is empty
stdout
Array
(
    [0] => 0:16
    [1] => 1:8
    [2] => 2:11
    [3] => 3:5
    [4] => 4:5
    [5] => 5:13
    [6] => 6:42
)