Bluehost.com Web Hosting $6.95

strrpos and offset?

This is a discussion on strrpos and offset? within the alt.comp.lang.php forums, part of the PHP Programming Forums category; Hi, I'm using PHP 4.3.4 the docs at: http://uk.php.net/manual/en/function.strrpos.php ...


Go Back   Usenet Forums > PHP Programming Forums > alt.comp.lang.php

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 03-03-2004
Owen Williams
 
Posts: n/a
Default strrpos and offset?

Hi,
I'm using PHP 4.3.4 the docs at:

http://uk.php.net/manual/en/function.strrpos.php

tells me that strrpos can be passed an offset as the third
argument.

Can it?

E.g. strrpos($page, "/", $lastslash);

And are there class descriptions/header files for php libraries
so that I can check the syntax.

Thanks,

Owen.
Reply With Quote
  #2 (permalink)  
Old 03-04-2004
Janwillem Borleffs
 
Posts: n/a
Default Re: strrpos and offset?

Owen Williams wrote:
> Hi,
> I'm using PHP 4.3.4 the docs at:
>
> http://uk.php.net/manual/en/function.strrpos.php
>
> tells me that strrpos can be passed an offset as the third
> argument.
>
> Can it?
>
> E.g. strrpos($page, "/", $lastslash);
>


Yes, as of PHP v5, the following will work:

$string = "abc/def/";
$pos = strrpos($string, "/", -2);
$string = substr($string, 0, $pos);

print $string; // prints abc

In PHP 4.x, only two arguments are accepted.

Read the note on the page that you have mentioned for details.

> And are there class descriptions/header files for php libraries
> so that I can check the syntax.
>


Sure, just download the source code distribution from www.php.net.


JW



Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT +1. The time now is 06:16 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0