![]() ![]() This is also one of the example of preg_split() function of PHP Programming Language. Then the “$result1” variable value will be printed with the help of “print_r()” function. Here “//” is the pattern parameter, input string value given is the subject parameter which is to be splitted, “-1” is the limit value which means it has no limit and splitting will be done up to the end of the string and the normal FLAG parameter used as usually based on our requirement. Then a variable “$result1” is created by assigning the preg_split() function to it with the basic four parameters as mentioned in the syntax. ![]() In the below syntax, a variable “$inputstrVal1” is created and assigned a string “PavanSake” to it. This is the example of illustrating the preg_split() function of PHP programming language. One can call all those values which are split using the index values of the array like array etc.Preg_split() function works by splitting some terms/text/special characters from the original string text provided and then stores in a specific mentioned variables name’s index values which is nothing but in an array.The preg_split() function will return an array element only when the original array or the string’s limit exceeds because the condition is TRUE otherwise it will be FALSE.The preg_split() function will help in returning the array when the split boundaries are matched.PREG_SPLIT_OFFSET_CAPTURE: If the flag parameter is set to the “PREG_SPLIT_OFFSET_CAPTURE”, for each and every occurring match string offset is going to be returned and also helps in changing the return value of the array in which the matched string offset will be set to the “0” value and the input string offset value is set to the value “1”.PREG_SPLIT_DELIM_CAPTURE: If the flag parameter is set to the “PREG_SPLIT_DELIM_CAPTURE”, delimiter pattern of the parenthesized expression will be returned and captured.PREG_SPLIT_NO_EMPTY: If the flag parameter/variable is set to the “PREG_SPLIT_NO_EMPTY”, preg_split() function will return only non-empty pieces.Flag: The flag/flags parameter helps to signalize and flag’s variable type/types is used to indicate the two state TRUE or two state FALSE in order to control the program. If the limit is either “0” or “-1”, the limit parameter will be assigned as “no limit” then it is used by the “$strflag” (flag).Ĥ. If the limit of the function is defined then small string or the sub string will be returned only up to the limit. Limit: The limit parameter will indicate the limit of the preg_split() function. Subject: The $subject parameter is the variable which usually helps in storing the input string.ģ. Pattern: The type of value used in the preg_split() function is string type in which the pattern will search as a string if not it will separate the elements.Ģ. ![]() The preg_split() function usually accepts four parameters just as mentioned in the above syntax.ġ. Syntax: array preg_split( $pattern, $subject, $limit, $flag ) ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |