Welcome to WebmasterWorld Guest from 54.152.38.154

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

strrpos problem on Windows with IIS

problem is due to forward slash

     
6:50 am on Sep 24, 2008 (gmt 0)

Junior Member

10+ Year Member

joined:Sept 8, 2006
posts: 115
votes: 0


Hi,

When I run the following code on Apache on Windows:


$string = "<body><new></new><tr><td>dfdfdfdfdf</td></tr><content>Sdsdfdfdfd</content></body>";

print strrpos($string,"</tr>");

It returns 40.

But when I run the same code on IIS on Windows it returns 74. The problem is due to the / with tr.
I tried using // and \/ to escape but didn't work. How do I make it work?

Thanks

8:21 am on Sept 24, 2008 (gmt 0)

Junior Member

10+ Year Member

joined:June 6, 2005
posts:109
votes: 0


This isn't an IIS problem, it's a PHP version problem.

Strrpos in PHP4 only takes a single character to search for, not a string. If you enter a string it'll just search for the first character of that string. Which in your example is '<' which is at position 74.

To get it to work upgrade to PHP5 or use something different to strrpos.

9:08 am on Sept 24, 2008 (gmt 0)

Junior Member

10+ Year Member

joined:Sept 8, 2006
posts:115
votes: 0


Oh yes and this is also mentioned @ php.net/strrpos which I over looked. Thanks.
 

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members