Ask a Question related to PHP Development, Design and Development.

  1. #1

    Default strrpos and offset?

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

    [url]http://uk.php.net/manual/en/function.strrpos.php[/url]

    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 Guest

  2. Similar Questions and Discussions

    1. Offset in Columnchart
      Hi, Does anyone has try the offset of Column chart? I try to make some column chart with column overlapping one another. However, the example...
    2. #26255 [Opn->Bgs]: strrpos gives wrong result
      ID: 26255 Updated by: iliaa@php.net Reported By: hongnk at hotmail dot com -Status: Open +Status: ...
    3. #26255 [NEW]: strrpos gives wrong result
      From: hongnk at hotmail dot com Operating system: Win2K PHP version: 4.3.4 PHP Bug Type: Scripting Engine problem Bug...
    4. exec at offset != 0
      Hi I would like to be able to simulate an exec but starting at byte N in a file (without creating a temporary file which is exec'ed later) I...
    5. note 33776 added to function.strrpos
      I'm new to this and I made a little tidbit that will take a pathname of a folder and find out what it's parent folder is, or, find the path of what...
  3. #2

    Default Re: strrpos and offset?

    Owen Williams wrote:
    > Hi,
    > I'm using PHP 4.3.4 the docs at:
    >
    > [url]http://uk.php.net/manual/en/function.strrpos.php[/url]
    >
    > 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 [url]www.php.net[/url].


    JW



    Janwillem Borleffs Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139