Re: Manipulating strings
| From: | Micah Gersten | Date: | Wed, 08 Oct 2008 02:24:47 +0000 |
| Subject: | Re: Manipulating strings | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-281565@lists.php.net to get a copy of this message | ||
Then you'll need this as well:
http://us.php.net/manual/en/function.strlen.php
**strpos** ( $text , '<br />'
<http://us.php.net/manual/en/language.pseudo-types.php#language.types.mixed>,
strlen($text)/2 );
Will give you the position.
Use str_replace to insert your ad.
Thank you,
Micah Gersten
onShore Networks
Internal Developer
http://www.onshore.com
Ron Piggott wrote:
> The first question was to find out how long the blog entry was (number
> of paragraphs.)
>
> I am wanting to put an ad in half way. Consequently there are going to
> be many <br /> 's before the one I am wanting to add text to.
>
> How should I handle this?
>
> Ron
>
> On Tue, 2008-10-07 at 20:55 -0500, Micah Gersten wrote:
>
>> For the second question:
>> http://us.php.net/manual/en/function.strpos.php
>> http://us.php.net/manual/en/function.str-replace.php
>>
>> Thank you,
>> Micah Gersten
>> onShore Networks
>> Internal Developer
>> http://www.onshore.com
>>
>>
>>
>> Ron Piggott wrote:
>>
>>> I have a series of questions.
>>>
>>> How do I count the number of <br /> 's in a string?
>>>
>>> How do I add text in the middle of a string, let's say after the 3rd
>>> <br />
>>>
>>> Ron
>>>
>>>
>>>
>>>