On Wed, 30 Jan 2002 12:10:14 +0000, you wrote: >Could someone please email me and tell me how to split a string into >different arrays
<? /* this is our start string */ $str = "this:is:a:test:string"; /* split accepts a regular expression and a string, and returns an array */ /* we could also use preg_split() or explode() */ $arr = split(':', $str); /* for each element of $arr */ for ($i = 0; $i < sizeof($arr); $i++) { /* display element */ echo($arr[$i]); echo('<br>'); } /* I know it's weird, but use sizeof() for arrays, and strlen() for strings */ echo('$arr has ' . sizeof($arr) . ' elements<br>'); echo('$str has ' . strlen($str) . ' characters<br>'); ?> >and save what they were split on? Not sure what this means. >Also I cant get the sizeof function to work no matter what syntax i use, i >think ive tried them all, do you have to include a library or something in >your program to make it work? If the above doesn't work, then maybe there's something wrong with your install. djo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]