![]() |
|
#1
|
||||
|
||||
Find the last occurrence of a string in a stringI am in need of a simple PHP script to find the position of the LAST occurrence of a string, within a string.
For example, if I was searching for the last me in the following string, I would expect the script to return 30: Code:
__________________
J de Silva Learning Journal | GIDForums™ | GIDNetwork™ | GIDWebhosts™ | GIDSearch™ |
|
#2
|
||||
|
||||
Re: Find the last occurrence of a string in a stringHow about the strrpos() function?
(tag won't keep the newline [before 'echo'] for some reason) PHP Code:
__________________
Use the force...read the source!! WYCIWYG -- what you code is what you get! |
|
#3
|
||||
|
||||
Re: Find the last occurrence of a string in a stringQuote:
I am sorry, but I should have mentioned it already -- I am using PHP 4. __________________
J de Silva Learning Journal | GIDForums™ | GIDNetwork™ | GIDWebhosts™ | GIDSearch™ |
|
#4
|
||||
|
||||
Re: Find the last occurrence of a string in a stringAh ha, I missed that line in the manual...
Ok then, taking an example from the last post on that page, slightly modified, how about this: PHP Code:
__________________
Use the force...read the source!! WYCIWYG -- what you code is what you get! |
|
#5
|
||||
|
||||
Re: Find the last occurrence of a string in a stringGood one!
I am doing more than one thing at this time, so excuse me for not going through the comments (on that page) sooner. __________________
J de Silva Learning Journal | GIDForums™ | GIDNetwork™ | GIDWebhosts™ | GIDSearch™ |
Recent GIDBlog
Python ebook by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Read a .html file, check that file for links | salemite | C Programming Language | 10 | 17-Jan-2008 07:56 |
| Message Class | TransformedBG | C++ Forum | 5 | 29-Nov-2006 21:28 |
| Help wit my source code compiler errors | Krandygrl00 | C++ Forum | 1 | 06-Jun-2005 08:14 |
| Converting string to float | CT++ | C++ Forum | 2 | 10-May-2005 11:29 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The