★ wanayoo — archive 1999 http://fr.php.net/manual/function.preg-split.phpNouvelle recherche | Portail wanayoo

PHP Home Page

Manual Table of Contents
Up to PCRE
Quick Reference
English version of this pageGerman version of this pageJapanese version of this page
Italian version of this pageFrench version of this pageHungarian version of this page
Spanish version of this pageDutch version of this pageBrazilian Portuguese version of this page
Korean version of this pageCzech version of this page
PCRE
* preg_match
* preg_match_all
* preg_replace
* preg_split
* preg_quote
* preg_grep
* Pattern Modifiers
* Pattern Syntax

  Thanks to:
 Chek.com
 easyDNS
 VA Linux Systems

  Related sites:
Apache
MySQL
PostgreSQL
Zend Tech.

  Community:
LinuxFund.org
OSDN
Manual: preg_split
View the source code for this pageSearch the site



Previous page
 preg_replace
 Updated
Mon, 08 Jan 2001
preg_quote 
Next page


preg_split

(PHP 3>= 3.0.9, PHP 4 )

preg_split -- Split string by a regular expression

Description

array preg_split (string pattern, string subject [, int limit [, int flags]])

Note: Parameter flags was added in PHP 4 Beta 3.

Returns an array containing substrings of subject split along boundaries matched by pattern.

If limit is specified, then only substrings up to limit are returned.

If flags is PREG_SPLIT_NO_EMPTY then only non-empty pieces will be returned by preg_split().

Example 1. preg_split() example

Get the parts of a search string.


// split the phrase by any number of commas or space characters,
// which include " ", \r, \t, \n and \f
$keywords = preg_split ("/[\s,]+/", "hypertext language, programming");
     

Splitting a string into component characters.


$str = 'string';
$chars = preg_split('//', $str, 0, PREG_SPLIT_NO_EMPTY);
print_r($chars);
     

See also preg_match(), preg_match_all(), and preg_replace().


 About Notes


Previous page
 preg_replace
 Updated
Mon, 08 Jan 2001
preg_quote 
Next page





Who's responsible for this?
Top of this page

Site
Hosting:



Located in
France
Elements of this website are subject to copyright.
Questions about installing or using PHP should be directed to one of the mailing lists.
Only questions about the website should be directed to webmaster@php.net.