the delimiter character ($dlm1, and $dlm2) can be any character, for example: space character, dash, dot, comma, :, etc. An array is a single variable which can store multiple values at a time. The PHP echo statement is used to output the result on the screen. The below program is to split a string as array elements based on delimiter using PHP explode() function. This URL contains the hyphens as separators. $dlm2 = the character that separates the pairs of sub-strings: "Name Number" PHP program to split a string as array elements based on delimiter. For example, if we get the current URL with SERVERREQUESTURI. $dlm1 = the character that separates the Name by Number See the examples and the comments in code. This function separates the "Name" and "Number", and adds them into two separated arrays, in their order from string. If the split length is specified, then array will be broken down into. It is used to convert a string to an array. The function presented in this page can be used in PHP to split an alphanumeric string (a string with multiple pairs of sub-strings with: "Name Number", separated by certain characters). The strsplit() is predefined function of PHP.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |