[PHP] Re: Manipulating strings

2008-10-10 Thread "Crash" Dummy
> I have a series of questions. > How do I count the number of 's in a string? > How do I add text in the middle of a string, let's say after the > 3rd ? If all you want to do is count the number of line breaks, then the substr_count function that Micah recommends will do the job. I suspect tha

Re: [PHP] Re: Manipulating strings

2008-10-08 Thread Ashley Sheridan
On Wed, 2008-10-08 at 11:37 -0700, Yeti wrote: > #let's say we got following string: > $some_string = 'blah blahblah blah'; > var_dump(explode('', $some_string)); > /* OUTPUT: > array(4) { > [0]=> > string(0) "" > [1]=> > string(9) "blah blah" > [2]=> > string(9) "blah blah" > [3]=>

Re: [PHP] Re: Manipulating strings

2008-10-08 Thread Yeti
blah blahblah blah'; var_dump(explode('', $some_string)); /* OUTPUT: array(4) { [0]=> string(0) "" [1]=> string(9) "blah blah" [2]=> string(9) "blah blah" [3]=> string(0) "" } */ #So as you see index 0 and index 3 are empty strings. Keep that in mind ?> -- PHP General Mailing List

[PHP] Re: Manipulating strings

2008-10-08 Thread Nathan Rixham
Ron Piggott wrote: I have a series of questions. How do I count the number of 's in a string? How do I add text in the middle of a string, let's say after the 3rd Ron simplest way from experience is to simply explode('', $the_string) you can then count the array -1 for number of br's; and