PHP Using Preg_Split() To Break Up Strings – String Function

<?
$text = "a, o, p";
$fruitarray = preg_split( "/, | and /", $text );
print "<pre>\n";
print_r( $fruitarray );
print "

\n”;
?>

Enjoyed this post? Share it!

 

Leave a comment

Your email address will not be published.