Re: Re: String manipulation
| From: | Ron Piggott | Date: | Sun, 14 Nov 2010 22:48:14 +0000 |
| Subject: | Re: Re: String manipulation | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-309483@lists.php.net to get a copy of this message | ||
I am receiving this error:
Warning: strpos() [function.strpos]: Offset not contained in string
I have never seen it before, what do I do? I made one change to it though, you didn’t have
<br> in it before so I changed the syntax to:
$pos = (strpos(' ', $activity_description_result,
76))?strpos('<br>',$activity_description_result,
76):strlen($activity_description_result);
Ron
The Verse of the Day
“Encouragement from God’s Word”
http://www.TheVerseOfTheDay.info
From: ash@ashleysheridan.co.uk
Sent: Sunday, November 14, 2010 4:58 PM
To: Ron Piggott ; php-general@lists.php.net
Subject: Re: [PHP] Re: String manipulation
What about something like this:
$pos = (strpos(' ', $string, 76))?strpos(' ',$string, 76):strlen($string);
Thanks,
Ash
http://www.ashleysheridan.co.uk
----- Reply message -----
From: "Ron Piggott" <ron.piggott@actsministries.org>
Date: Sun, Nov 14, 2010 20:48
Subject: [PHP] Re: String manipulation
To: <php-general@lists.php.net>
How would I write an IF statement that looks for the first space space (“ “) left of the 76th
character in a string or <br>, which ever comes first --- OR the end of the string (IE the
string is less than 76 characters long? I specifically want is it’s character position in the
string. Ron
The Verse of the Day
“Encouragement from God’s Word”
http://www.TheVerseOfTheDay.info