Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Possible bug with Uri::segment()
  • Hi all,
    I've tried to retrieve segment information. Here is my print:

    Uri::segments();
    Array
    (

        [0] => blog

        [1] => 2013

        [2] => 4

        [3] => snippet-how-to-remove-svn-information-from-a-folder

    )

    Uri::segment(0);
    EMPTY STRING

    Uri::segment(1);
    'blog'

    Uri::segment(1);
    '2013'

    Is it my fault or Uri::segment(0); should be "blog" (and go on)?
  • HarroHarro
    Accepted Answer
    According to the docblock in the code, the index is base-1, so there is no such thing as segment(0). Which is logical, you're asking for the first segment.

    segments() gives you the raw segment dump in an array, and arrays always start at 0.
  • Hi,

    It's normal "Segment index is 1 based, not 0 based" 
  • Sorry, I lost that line ... Thanks guys :-]

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion