在数组的每个索引中拆分字符串的第一部分并保留字符串的其余部分

Below is my array:

Array
(
[0] =>  2016-03-31 abc xyz  
[1] =>  2016-03-31 ef yz    
[2] =>  2016-04-05 ghij aei 
)

I need to remove the date from all the indexes in the above array and retain only the rest of the string.

Expected output:

Array
(
[0] =>  abc xyz 
[1] =>  ef yz   
[2] =>  ghij aei    
)

Thanks, Madhuri

Something like this will do, if the dates always come first and are in the same format (10 symbols):

foreach ($array as &$v) {$v = trim(substr($v, 10));}
for($i = 0; $i < count($array); $i++) {
   $result[$i] =substr($array[$i], 11,);  
}

Since there are other answers:

$result = preg_replace('/\d\d\d\d-\d\d-\d\d(.*)/', '$1', $array);

Or it could be shorter:

$result = preg_replace('[\d-]{10}(.*)/', '$1', $array);

Considering the first space in the string as delimiter:

foreach ($arr as &$v) {
    $v = substr($v, strpos($v, " "));
}

print_r($arr);

The output:

Array
(
    [0] =>  abc xyz
    [1] =>  ef yz
    [2] =>  ghij aei
)

One more option:

foreach ($array as $value) {
    $new[] = explode(' ', $value, 2)[1];
}

Dereferencing the explode result requires PHP >= 5.4.