Search in the array for the first occurrence of a string until space, then convert it to month.
$arr = [
 "May Hello",
 "Jun Hello12",
 "Jul 3"
];
$str =  $arr[0];
$matches = [];
$pattern = '/^\w+\s/';
preg_match_all($pattern, $str, $matches);
Replace $pattern in $arr:
$pattern = [
 '/^\w+\s/' => date('m', strtotime($matches[0][0])) . ' ', // fist string until space
];
$arr = preg_replace(array_keys($pattern), array_values($pattern), $arr);
echo '<pre>';
print_r($arr);
echo '</pre>';
unexpected:
Array
(
    [0] => 05 7 Hello
    [1] => 05 Hello12
    [3] => 05 3
)
expected:
Array
(
    [0] => 05 7 Hello
    [1] => 06 Hello12
    [3] => 07 3
)
What am I doing wrong?
 
     
     
    