preg_split.php : preg_split « String « PHP






preg_split.php

 
<?php
   $delimitedText = "+A+++G+++++++++++C";
   $fields = preg_split("/\+{1,}/", $delimitedText);
    foreach($fields as $field) echo $field."<br />";
?>
  
  








Related examples in the same category

1.Calculating average word length
2.preg_split() Flags
3.preg_split() function operates like split(), except that regular expressions are accepted as input parameters for pattern.
4.Discarding empty elements with preg_split()
5.How preg_split() can be used:
6.Limiting the number of returned elements with preg_split()
7.Parsing a date with preg_split()
8.Using preg_split()
9.Using preg_split() to Break Up Strings