www.evidhyashala.com provides free free mock test , free online exam , online exam free test series , online exam free , Online Test Exam Series , free exam papers past papers , online exam form ,Online Test Series for Exam Prep. Free Mock Tests - for All govt jobs. Bank PO, Clerk, SSC CGL, CHSL, JE, GATE, Insurance, Railways, IBPS RRB, SBI, RBI, IPPB, BSNL TTA

Sponser Link

know more info pls click here

php Splitting a string into an array r&d/22112011


PHP Splitting a string into an array

The following two functions split strings:

array split(string pattern, string source [, integer limit])
array spliti(string pattern, string source [, integer limit])

They split the source string into an array, breaking the string where the matching pattern is found. These functions perform a similar task to the explode( ) function described earlier and as with explode( ), a limit can be specified to determine the maximum number of elements in the array.

The following simple example shows how split( ) can break a sentence into an array of "words" by recognizing any sequence of nonalphabetic characters as separators:

$sentence = "I wonder why he does\nBuzz, buzz, buzz!";
$words = split("[^a-zA-Z]+", $sentence);

When complex patterns aren't needed to break a string into an array, the explode( ) function makes a better choice.


0 comments:

Popular Posts