the m modifier to change the behavior of $ : Replace « String « PHP






the m modifier to change the behavior of $

<?

$text = "Name: matt\noccupation: coder\neyes: blue\n";
preg_match_all( "/^\w+:\s+(.*)$/m", $text, $array );

foreach ( $array[1] as $val ) {
    print "$val<br>";
}
?>

           
       








Related examples in the same category

1.preg_replace: replace date