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 ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
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. |
|
|||
|
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 |