Greetings- I'm have the follwing string called $text and throughout this string I'd like to split this into an array by calling spliti() at the tag called PAGEBREAK.
So, I count the array elements starting at 0 and get to 9. When I call count(), I get 11. Could somebody please explain why this is? Thank you. TR ................. <? $text=" aaa[PAGEBREAK] //this is the 0 element bbb[PAGEBREAK] //[1] ccc[PAGEBREAK] //[2] ddd[PAGEBREAK] //[3] eee[PAGEBREAK] //[4] fff[PAGEBREAK] //[5] ggg[PAGEBREAK] //[6] hhh[PAGEBREAK] //[7] iii[PAGEBREAK] //[8] jjj[PAGEBREAK] //...and this is the 9th element "; $regexp="\[PAGEBREAK]"; $textarray=spliti($regexp,$text); $num_array=count($textarray); $another_num_array=count($textarray)-1; echo "There are ".$num_array." elements using the count() function.<br>"; echo "If I subtract 1 since elements begin at 0, there are ".$another_num_array."."; //This is the output using count(): //............... //There are 11 elements using the count() function. //If I subtract 1 since elements begin at 0, there are 10 ?> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php