Posts

Showing posts with the label split

How to split an array to parts by comma or special character (string to array) ?

Use explode function for this job: $names = 'John,Margaret,Thomas'; $namesArray = explode( ',' , $names ); echo $namesArray[0]; echo $namesArray[1]; echo $namesArray[2]; You can also use a character sequence to split string like a "splitplace"