- array_map: documentation ( source)
- mt_rand: documentation ( source)
- implode: documentation ( source)
- str_split: documentation ( source)
<?php
$number = 123456;
echo implode(array_map(function($v){
return $v % 2 !== 0 ? mt_rand(0, 9) : $v;
}, str_split($number)));