PHP Coding tips & tricks. Function & error explanation, coding style, how tos etc. Short notes posted directly from developer work environment.
PHP Coding Tips
Tuesday, August 7, 2012
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"
No comments:
Post a Comment