Converting a string to an array in PHP

It is possible to convert a string to an array in PHP, this is done using explode function. This function takes three arguments. Two arguments are mandatory and the third one is optional. First argument is a character that identifies the character that is between elements of this string that will become array elements. Second argument is the name of the array. Third argument is optional. By default a string will be converted to a single array. If the value of this argument is specified, then array will contain as many elements as specified, The last array element will contain the rest of the string. 

If the last argument is negative, then all parts of the string will be converted to an array except as many elements as specified.

Comments

Popular posts from this blog

Absolute and relative path in HTML pages

Errors

goto PHP operator